Commit c6379b5d authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-34] Upgraded to latest joscar. Most useless error messages gone. Some...

[GATE-34] Upgraded to latest joscar.  Most useless error messages gone.  Some still exist though.  Generally, must nicer.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk/src/plugins/gateway@5389 b35dd754-fafc-0310-a699-88a17e54d16e
parent b83230da
......@@ -4,7 +4,8 @@ cindy.jar | 2.4.4
commons-logging | 1.1
irclib.jar | 1.04
jml.jar | 1.0a2 (patched)
joscar.jar | 0.9.3 (patched)
joscar-common.jar | svn-20060915
joscar-protocol.jar | svn-20060915
picocontainer.jar | 1.2.0
ymsg_network.jar | 0.61
ymsg_support.jar | 0.6
......@@ -25,6 +25,8 @@ import net.kano.joscar.snaccmd.ssi.*;
import net.kano.joscar.ssiitem.*;
import java.net.InetAddress;
import java.util.Arrays;
import java.util.List;
import org.jivesoftware.util.Log;
......@@ -37,10 +39,6 @@ import org.jivesoftware.util.Log;
public class BOSConnection extends BasicFlapConnection {
protected SsiItemObjectFactory itemFactory = new DefaultSsiItemObjFactory();
public BOSConnection(OSCARSession mainSession, ByteBlock cookie) {
super(mainSession, cookie); // HAnd off to BasicFlapConnection
}
public BOSConnection(String host, int port, OSCARSession mainSession, ByteBlock cookie) {
super(host, port, mainSession, cookie); // HAnd off to BasicFlapConnection
}
......@@ -79,9 +77,9 @@ public class BOSConnection extends BasicFlapConnection {
if (cmd instanceof LocRightsCmd) {
request(new SetInfoCmd(new InfoData("oscargateway",
null, new CapabilityBlock[] {
null, Arrays.asList(new CapabilityBlock[] {
CapabilityBlock.BLOCK_ICQCOMPATIBLE,
}, null)));
}), null)));
request(new MyInfoRequest());
} else if (cmd instanceof ParamInfoCmd) {
ParamInfoCmd pic = (ParamInfoCmd) cmd;
......@@ -119,7 +117,7 @@ public class BOSConnection extends BasicFlapConnection {
} else if (cmd instanceof SsiDataCmd) {
SsiDataCmd sdc = (SsiDataCmd) cmd;
SsiItem[] items = sdc.getItems();
List<SsiItem> items = sdc.getItems();
for (SsiItem item : items) {
SsiItemObj obj = itemFactory.getItemObj(item);
if (obj instanceof BuddyItem) {
......
......@@ -14,14 +14,18 @@ package org.jivesoftware.wildfire.gateway.protocols.oscar;
import org.jivesoftware.util.Log;
import net.kano.joscar.flap.*;
import net.kano.joscar.flapcmd.*;
import net.kano.joscar.net.*;
import net.kano.joscar.snac.*;
import net.kano.joscar.snaccmd.*;
import java.net.InetAddress;
import net.kano.joscar.flap.ClientFlapConn;
import net.kano.joscar.flap.FlapProcessor;
import net.kano.joscar.flap.FlapPacketListener;
import net.kano.joscar.flap.FlapPacketEvent;
import net.kano.joscar.snac.*;
import net.kano.joscar.flapcmd.DefaultFlapCmdFactory;
import net.kano.joscar.flapcmd.SnacCommand;
import net.kano.joscar.snaccmd.DefaultClientFactoryList;
import net.kano.joscar.net.*;
/**
* Base class for all FLAP handlers.
*
......@@ -32,19 +36,14 @@ public abstract class BaseFlapConnection extends ClientFlapConn {
protected ClientSnacProcessor sp;
OSCARSession oscarSession;
public BaseFlapConnection(OSCARSession mainSession) {
initBaseFlapConnection();
oscarSession = mainSession;
}
public BaseFlapConnection(String host, int port, OSCARSession mainSession) {
super(host, port); // Hand off to ClientFlapConn
super(new ConnDescriptor(host, port)); // Hand off to ClientFlapConn
initBaseFlapConnection();
oscarSession = mainSession;
}
public BaseFlapConnection(InetAddress ip, int port, OSCARSession mainSession) {
super(ip, port); // Hand off to ClientFlapConn
super(new ConnDescriptor(ip, port)); // Hand off to ClientFlapConn
initBaseFlapConnection();
oscarSession = mainSession;
}
......@@ -67,8 +66,8 @@ public abstract class BaseFlapConnection extends ClientFlapConn {
BaseFlapConnection.this.handleFlapPacket(e);
}
});
getFlapProcessor().addExceptionHandler(new FlapExceptionHandler() {
public void handleException(FlapExceptionEvent event) {
getFlapProcessor().addExceptionHandler(new ConnProcessorExceptionHandler() {
public void handleException(ConnProcessorExceptionEvent event) {
Log.error(event.getType() + " FLAP ERROR: "
+ event.getException().getMessage());
}
......
......@@ -15,24 +15,32 @@ package org.jivesoftware.wildfire.gateway.protocols.oscar;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.text.DateFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import net.kano.joscar.*;
import net.kano.joscar.flap.*;
import net.kano.joscar.flapcmd.*;
import net.kano.joscar.ratelim.*;
import net.kano.joscar.rv.*;
import net.kano.joscar.rvcmd.*;
import net.kano.joscar.snac.*;
import net.kano.joscar.snaccmd.*;
import net.kano.joscar.snaccmd.buddy.*;
import net.kano.joscar.snaccmd.conn.*;
import net.kano.joscar.snaccmd.icbm.*;
import java.util.*;
import org.jivesoftware.util.Log;
import org.xmpp.packet.Message;
import org.xmpp.packet.Presence;
import org.xmpp.packet.JID;
import net.kano.joscar.ByteBlock;
import net.kano.joscar.OscarTools;
import net.kano.joscar.BinaryTools;
import net.kano.joscar.flap.FlapCommand;
import net.kano.joscar.flap.FlapPacketEvent;
import net.kano.joscar.snac.SnacPacketEvent;
import net.kano.joscar.snac.SnacResponseEvent;
import net.kano.joscar.snac.SnacRequest;
import net.kano.joscar.snac.SnacRequestListener;
import net.kano.joscar.flapcmd.LoginFlapCmd;
import net.kano.joscar.flapcmd.SnacCommand;
import net.kano.joscar.rvcmd.DefaultRvCommandFactory;
import net.kano.joscar.snaccmd.conn.*;
import net.kano.joscar.snaccmd.*;
import net.kano.joscar.snaccmd.icbm.RecvImIcbm;
import net.kano.joscar.snaccmd.icbm.InstantMessage;
import net.kano.joscar.snaccmd.buddy.BuddyStatusCmd;
import net.kano.joscar.snaccmd.buddy.BuddyOfflineCmd;
import net.kano.joscar.rv.*;
import net.kano.joscar.ratelim.RateLimitingQueueMgr;
/**
* Handles incoming FLAP packets.
......@@ -44,10 +52,10 @@ public abstract class BasicFlapConnection extends BaseFlapConnection {
protected final ByteBlock cookie;
protected boolean sentClientReady = false;
public Map<String,FullUserInfo> buddystore = new HashMap<String,FullUserInfo>();
public Map<String,FullUserInfo> buddystore = new HashMap<String, FullUserInfo>();
protected int[] snacFamilies = null;
protected SnacFamilyInfo[] snacFamilyInfos;
protected Collection<SnacFamilyInfo> snacFamilyInfos;
protected RateLimitingQueueMgr rateMgr = new RateLimitingQueueMgr();
protected RvProcessor rvProcessor = new RvProcessor(sp);
protected RvProcessorListener rvListener = new RvProcessorListener() {
......@@ -80,11 +88,6 @@ public abstract class BasicFlapConnection extends BaseFlapConnection {
rvProcessor.addListener(rvListener);
}
public BasicFlapConnection(OSCARSession mainSession, ByteBlock cookie) {
super(mainSession);
this.cookie = cookie;
}
public BasicFlapConnection(String host, int port, OSCARSession mainSession, ByteBlock cookie) {
super(host, port, mainSession);
this.cookie = cookie;
......@@ -125,8 +128,7 @@ public abstract class BasicFlapConnection extends BaseFlapConnection {
setSnacFamilies(src.getSnacFamilies());
SnacFamilyInfo[] familyInfos = SnacFamilyInfoFactory
.getDefaultFamilyInfos(src.getSnacFamilies());
Collection<SnacFamilyInfo> familyInfos = SnacFamilyInfoFactory.getDefaultFamilyInfos(src.getSnacFamilies());
setSnacFamilyInfos(familyInfos);
......@@ -185,7 +187,7 @@ public abstract class BasicFlapConnection extends BaseFlapConnection {
p.setShow(Presence.Show.away);
}
ExtraInfoBlock[] extraInfo = info.getExtraInfoBlocks();
List<ExtraInfoBlock> extraInfo = info.getExtraInfoBlocks();
if (extraInfo != null) {
for (ExtraInfoBlock i : extraInfo) {
ExtraInfoData data = i.getExtraData();
......@@ -238,11 +240,11 @@ public abstract class BasicFlapConnection extends BaseFlapConnection {
if (cmd instanceof RateInfoCmd) {
RateInfoCmd ric = (RateInfoCmd) cmd;
RateClassInfo[] rateClasses = ric.getRateClassInfos();
List <RateClassInfo> rateClasses = ric.getRateClassInfos();
int[] classes = new int[rateClasses.length];
for (int i = 0; i < rateClasses.length; i++) {
classes[i] = rateClasses[i].getRateClass();
int[] classes = new int[rateClasses.size()];
for (int i = 0; i < rateClasses.size(); i++) {
classes[i] = rateClasses.get(i).getRateClass();
}
request(new RateAck(classes));
......@@ -256,7 +258,7 @@ public abstract class BasicFlapConnection extends BaseFlapConnection {
Arrays.sort(snacFamilies);
}
protected void setSnacFamilyInfos(SnacFamilyInfo[] infos) {
protected void setSnacFamilyInfos(Collection<SnacFamilyInfo> infos) {
snacFamilyInfos = infos;
}
......@@ -325,7 +327,7 @@ public abstract class BasicFlapConnection extends BaseFlapConnection {
p.setShow(Presence.Show.away);
}
ExtraInfoBlock[] extraInfo = info.getExtraInfoBlocks();
List<ExtraInfoBlock> extraInfo = info.getExtraInfoBlocks();
if (extraInfo != null) {
for (ExtraInfoBlock i : extraInfo) {
ExtraInfoData data = i.getExtraData();
......@@ -377,7 +379,7 @@ public abstract class BasicFlapConnection extends BaseFlapConnection {
p.setShow(Presence.Show.away);
}
ExtraInfoBlock[] extraInfo = info.getExtraInfoBlocks();
List<ExtraInfoBlock> extraInfo = info.getExtraInfoBlocks();
if (extraInfo != null) {
for (ExtraInfoBlock i : extraInfo) {
ExtraInfoData data = i.getExtraData();
......@@ -402,7 +404,7 @@ public abstract class BasicFlapConnection extends BaseFlapConnection {
}
oscarSession.getTransport().sendPacket(p);
}
}
}
......@@ -33,10 +33,6 @@ import java.net.InetAddress;
public class LoginConnection extends BaseFlapConnection {
protected boolean loggedin = false;
public LoginConnection(OSCARSession mainSession) {
super(mainSession); // Hand off to BaseFlapConnection
}
public LoginConnection(String host, int port, OSCARSession mainSession) {
super(host, port, mainSession); // Hand off to BaseFlapConnection
}
......
......@@ -10,22 +10,23 @@
package org.jivesoftware.wildfire.gateway.protocols.oscar;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import net.kano.joscar.flapcmd.*;
import net.kano.joscar.snac.*;
import net.kano.joscar.snaccmd.*;
import net.kano.joscar.snaccmd.conn.*;
import net.kano.joscar.snaccmd.icbm.*;
import net.kano.joscar.snaccmd.loc.*;
import net.kano.joscar.snaccmd.ssi.*;
import net.kano.joscar.ssiitem.*;
import net.kano.joscar.ByteBlock;
import net.kano.joscar.flapcmd.SnacCommand;
import net.kano.joscar.snac.SnacRequest;
import net.kano.joscar.snac.SnacRequestListener;
import net.kano.joscar.snaccmd.ssi.CreateItemsCmd;
import net.kano.joscar.snaccmd.ssi.DeleteItemsCmd;
import net.kano.joscar.snaccmd.ssi.ModifyItemsCmd;
import net.kano.joscar.snaccmd.icbm.SendImIcbm;
import net.kano.joscar.snaccmd.conn.ServiceRequest;
import net.kano.joscar.snaccmd.loc.SetInfoCmd;
import net.kano.joscar.snaccmd.InfoData;
import net.kano.joscar.snaccmd.CapabilityBlock;
import net.kano.joscar.ssiitem.BuddyItem;
import net.kano.joscar.ssiitem.GroupItem;
import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.gateway.PresenceType;
import org.jivesoftware.wildfire.gateway.Registration;
......@@ -70,8 +71,8 @@ public class OSCARSession extends TransportSession {
/**
* SSI tracking variables.
*/
private ConcurrentHashMap<String,BuddyItem> buddies = new ConcurrentHashMap<String,BuddyItem>();
private ConcurrentHashMap<Integer,GroupItem> groups = new ConcurrentHashMap<Integer,GroupItem>();
private ConcurrentHashMap<String, BuddyItem> buddies = new ConcurrentHashMap<String,BuddyItem>();
private ConcurrentHashMap<Integer, GroupItem> groups = new ConcurrentHashMap<Integer,GroupItem>();
private ConcurrentHashMap<Integer,Integer> highestBuddyIdPerGroup = new ConcurrentHashMap<Integer,Integer>();
private Integer highestGroupId = -1;
......@@ -127,7 +128,7 @@ public class OSCARSession extends TransportSession {
// Group doesn't exist, lets create a new one.
Integer newGroupId = highestGroupId + 1;
GroupItem newGroup = new GroupItem(groupName, newGroupId);
request(new CreateItemsCmd(new SsiItem[] { newGroup.toSsiItem() }));
request(new CreateItemsCmd(newGroup.toSsiItem()));
highestGroupId = newGroupId;
groups.put(newGroupId, newGroup);
......@@ -158,7 +159,7 @@ public class OSCARSession extends TransportSession {
BuddyItem newBuddy = new BuddyItem(contact, newBuddyId, groupId);
newBuddy.setAlias(nickname);
request(new CreateItemsCmd(new SsiItem[] { newBuddy.toSsiItem() }));
request(new CreateItemsCmd(newBuddy.toSsiItem()));
buddies.put(groupId+"."+newBuddyId, newBuddy);
}
// Now, lets clean up any groups this contact should no longer be a member of.
......@@ -166,22 +167,22 @@ public class OSCARSession extends TransportSession {
if (buddy.getScreenname().equals(contact)) {
if (buddy.getGroupId() == 0) {
// Ok this group is the "main group", which we can cheerfully remove from.
request(new DeleteItemsCmd(new SsiItem[] { buddy.toSsiItem() }));
request(new DeleteItemsCmd(buddy.toSsiItem()));
buddies.remove(buddy.getGroupId()+"."+buddy.getId());
}
else if (!groups.contains(buddy.getGroupId())) {
// Well this is odd, a group we don't know about? Nuke it.
request(new DeleteItemsCmd(new SsiItem[] { buddy.toSsiItem() }));
request(new DeleteItemsCmd(buddy.toSsiItem()));
buddies.remove(buddy.getGroupId()+"."+buddy.getId());
}
else if (!grouplist.contains(groups.get(buddy.getGroupId()).getGroupName())) {
request(new DeleteItemsCmd(new SsiItem[] { buddy.toSsiItem() }));
request(new DeleteItemsCmd(buddy.toSsiItem()));
buddies.remove(buddy.getGroupId()+"."+buddy.getId());
}
else {
if (!buddy.getAlias().equals(nickname)) {
buddy.setAlias(nickname);
request(new ModifyItemsCmd(new SsiItem[] { buddy.toSsiItem() }));
request(new ModifyItemsCmd(buddy.toSsiItem()));
}
}
}
......@@ -209,7 +210,7 @@ public class OSCARSession extends TransportSession {
String legacyId = getTransport().convertJIDToID(item.getJid());
for (BuddyItem i : buddies.values()) {
if (i.getScreenname().equals(legacyId)) {
request(new DeleteItemsCmd(new SsiItem[] { i.toSsiItem() }));
request(new DeleteItemsCmd(i.toSsiItem()));
buddies.remove(i.getGroupId()+"."+i.getId());
}
}
......@@ -413,6 +414,10 @@ public class OSCARSession extends TransportSession {
bosConn.getAndSendStatus(getTransport().convertJIDToID(jid));
}
private static final List<CapabilityBlock> MY_CAPS = Arrays.asList(new CapabilityBlock[] {
CapabilityBlock.BLOCK_ICQCOMPATIBLE,
});
/**
* @see org.jivesoftware.wildfire.gateway.TransportSession#updateStatus(org.jivesoftware.wildfire.gateway.PresenceType, String)
*/
......@@ -422,10 +427,10 @@ public class OSCARSession extends TransportSession {
if (verboseStatus != null) {
awayMsg = verboseStatus;
}
request(new SetInfoCmd(new InfoData(awayMsg)));
request(new SetInfoCmd(new InfoData(awayMsg, null, MY_CAPS, null)));
}
else {
request(new SetInfoCmd(new InfoData(InfoData.NOT_AWAY)));
request(new SetInfoCmd(new InfoData(InfoData.NOT_AWAY, null, MY_CAPS, null)));
}
this.presenceType = presenceType;
......
......@@ -10,8 +10,11 @@
package org.jivesoftware.wildfire.gateway.protocols.oscar;
import org.jivesoftware.wildfire.gateway.*;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.wildfire.gateway.BaseTransport;
import org.jivesoftware.wildfire.gateway.TransportSession;
import org.jivesoftware.wildfire.gateway.PresenceType;
import org.jivesoftware.wildfire.gateway.Registration;
import org.xmpp.packet.JID;
/**
......
......@@ -12,14 +12,18 @@
package org.jivesoftware.wildfire.gateway.protocols.oscar;
import net.kano.joscar.*;
import net.kano.joscar.flap.*;
import net.kano.joscar.flapcmd.*;
import net.kano.joscar.net.*;
import net.kano.joscar.snac.*;
import net.kano.joscar.snaccmd.conn.*;
import net.kano.joscar.snaccmd.icon.*;
import net.kano.joscar.snaccmd.search.*;
import net.kano.joscar.flap.ClientFlapConn;
import net.kano.joscar.flap.FlapPacketEvent;
import net.kano.joscar.ByteBlock;
import net.kano.joscar.flapcmd.SnacCommand;
import net.kano.joscar.snaccmd.search.InterestListCmd;
import net.kano.joscar.snaccmd.search.SearchResultsCmd;
import net.kano.joscar.snaccmd.conn.RateInfoCmd;
import net.kano.joscar.snaccmd.icon.IconDataCmd;
import net.kano.joscar.snac.SnacPacketEvent;
import net.kano.joscar.snac.SnacResponseEvent;
import net.kano.joscar.net.ClientConnEvent;
import java.net.InetAddress;
......@@ -33,11 +37,6 @@ public class ServiceConnection extends BasicFlapConnection {
protected int serviceFamily;
public ServiceConnection(OSCARSession mainSession, ByteBlock cookie, int serviceFamily) {
super(mainSession, cookie);
this.serviceFamily = serviceFamily;
}
public ServiceConnection(String host, int port, OSCARSession mainSession, ByteBlock cookie, int serviceFamily) {
super(host, port, mainSession, cookie);
this.serviceFamily = serviceFamily;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment