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

[GATE-32] Tracked down cause of problem. add/remove/etc doesn't work with MSN...

[GATE-32] Tracked down cause of problem.  add/remove/etc doesn't work with MSN yet.  Will have to provide a 'partial support' MSN transport for first beta.
"known good" versions of cindy and jml
Cleanup of OSCAR handling here and there

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5391 b35dd754-fafc-0310-a699-88a17e54d16e
parent 011d1433
......@@ -106,12 +106,6 @@ public class MSNListener extends MsnAdapter {
* Contact list initialization has completed.
*/
public void contactListInitCompleted(MsnMessenger messenger) {
}
/**
* Contact list has been synced.
*/
public void contactListSyncCompleted(MsnMessenger messenger) {
for (MsnContact msnContact : messenger.getContactList().getContacts()) {
Log.debug("Got contact "+msnContact);
msnSession.storeFriend(msnContact);
......@@ -119,7 +113,13 @@ public class MSNListener extends MsnAdapter {
for (MsnGroup msnGroup : messenger.getContactList().getGroups()) {
msnSession.storeGroup(msnGroup);
}
msnSession.syncUsers();
msnSession.syncUsers();
}
/**
* Contact list has been synced.
*/
public void contactListSyncCompleted(MsnMessenger messenger) {
}
/**
......
......@@ -48,7 +48,7 @@ public class MSNSession extends TransportSession {
super(registration, jid, transport, priority);
msnMessenger = MsnMessengerFactory.createMsnMessenger(registration.getUsername(), registration.getPassword());
msnMessenger.setSupportedProtocol(new MsnProtocol[] { MsnProtocol.MSNP11 });
msnMessenger.setSupportedProtocol(MsnProtocol.getAllSupportedProtocol());
}
/**
......@@ -80,8 +80,8 @@ public class MSNSession extends TransportSession {
public void logIn(PresenceType presenceType, String verboseStatus) {
if (!this.isLoggedIn()) {
msnMessenger.getOwner().setInitStatus(((MSNTransport)getTransport()).convertJabStatusToMSN(presenceType));
msnMessenger.setLogIncoming(true);
msnMessenger.setLogOutgoing(true);
msnMessenger.setLogIncoming(false);
msnMessenger.setLogOutgoing(false);
msnMessenger.addListener(new MSNListener(this));
msnMessenger.login();
}
......@@ -172,37 +172,37 @@ public class MSNSession extends TransportSession {
* @see org.jivesoftware.wildfire.gateway.TransportSession#addContact(org.jivesoftware.wildfire.roster.RosterItem)
*/
public void addContact(RosterItem item) {
Email contact = Email.parseStr(getTransport().convertJIDToID(item.getJid()));
String nickname = getTransport().convertJIDToID(item.getJid());
if (item.getNickname() != null && !item.getNickname().equals("")) {
nickname = item.getNickname();
}
msnMessenger.addFriend(contact, nickname);
syncContactGroups(contact, item.getGroups());
// Email contact = Email.parseStr(getTransport().convertJIDToID(item.getJid()));
// String nickname = getTransport().convertJIDToID(item.getJid());
// if (item.getNickname() != null && !item.getNickname().equals("")) {
// nickname = item.getNickname();
// }
// msnMessenger.addFriend(contact, nickname);
// syncContactGroups(contact, item.getGroups());
}
/**
* @see org.jivesoftware.wildfire.gateway.TransportSession#removeContact(org.jivesoftware.wildfire.roster.RosterItem)
*/
public void removeContact(RosterItem item) {
Email contact = Email.parseStr(getTransport().convertJIDToID(item.getJid()));
MsnContact msnContact = msnContacts.get(contact.toString());
for (MsnGroup msnGroup : msnContact.getBelongGroups()) {
msnMessenger.removeFriend(contact, msnGroup.getGroupId());
}
// Email contact = Email.parseStr(getTransport().convertJIDToID(item.getJid()));
// MsnContact msnContact = msnContacts.get(contact.toString());
// for (MsnGroup msnGroup : msnContact.getBelongGroups()) {
// msnMessenger.removeFriend(contact, msnGroup.getGroupId());
// }
}
/**
* @see org.jivesoftware.wildfire.gateway.TransportSession#updateContact(org.jivesoftware.wildfire.roster.RosterItem)
*/
public void updateContact(RosterItem item) {
Email contact = Email.parseStr(getTransport().convertJIDToID(item.getJid()));
String nickname = getTransport().convertJIDToID(item.getJid());
if (item.getNickname() != null && !item.getNickname().equals("")) {
nickname = item.getNickname();
}
msnMessenger.renameFriend(contact, nickname);
syncContactGroups(contact, item.getGroups());
// Email contact = Email.parseStr(getTransport().convertJIDToID(item.getJid()));
// String nickname = getTransport().convertJIDToID(item.getJid());
// if (item.getNickname() != null && !item.getNickname().equals("")) {
// nickname = item.getNickname();
// }
// msnMessenger.renameFriend(contact, nickname);
// syncContactGroups(contact, item.getGroups());
}
/**
......@@ -216,30 +216,30 @@ public class MSNSession extends TransportSession {
if (groups.isEmpty()) {
groups.add("Transport Buddies");
}
MsnContact msnContact = msnContacts.get(contact.toString());
// Create groups that do not currently exist.
for (String group : groups) {
if (!msnGroups.containsKey(group)) {
msnMessenger.addGroup(group);
}
}
// Lets update our list of groups.
for (MsnGroup msnGroup : msnMessenger.getContactList().getGroups()) {
storeGroup(msnGroup);
}
// Make sure contact belongs to groups that we want.
for (String group : groups) {
MsnGroup msnGroup = msnGroups.get(group);
if (!msnContact.belongGroup(msnGroup)) {
msnMessenger.copyFriend(contact, group);
}
}
// Now we will clean up groups that we should no longer belong to.
for (MsnGroup msnGroup : msnContact.getBelongGroups()) {
if (!groups.contains(msnGroup.getGroupName())) {
msnMessenger.removeFriend(contact, msnGroup.getGroupId());
}
}
// MsnContact msnContact = msnContacts.get(contact.toString());
// // Create groups that do not currently exist.
// for (String group : groups) {
// if (!msnGroups.containsKey(group)) {
// msnMessenger.addGroup(group);
// }
// }
// // Lets update our list of groups.
// for (MsnGroup msnGroup : msnMessenger.getContactList().getGroups()) {
// storeGroup(msnGroup);
// }
// // Make sure contact belongs to groups that we want.
// for (String group : groups) {
// MsnGroup msnGroup = msnGroups.get(group);
// if (!msnContact.belongGroup(msnGroup)) {
// msnMessenger.copyFriend(contact, group);
// }
// }
// // Now we will clean up groups that we should no longer belong to.
// for (MsnGroup msnGroup : msnContact.getBelongGroups()) {
// if (!groups.contains(msnGroup.getGroupName())) {
// msnMessenger.removeFriend(contact, msnGroup.getGroupId());
// }
// }
}
/**
......@@ -280,15 +280,15 @@ public class MSNSession extends TransportSession {
msnMessenger.getOwner().setStatus(((MSNTransport)getTransport()).convertJabStatusToMSN(presenceType));
}
catch (IllegalStateException e) {
// Hrm, not logged in? Lets fix that.
msnMessenger.getOwner().setInitStatus(((MSNTransport)getTransport()).convertJabStatusToMSN(presenceType));
msnMessenger.login();
// // Hrm, not logged in? Lets fix that.
// msnMessenger.getOwner().setInitStatus(((MSNTransport)getTransport()).convertJabStatusToMSN(presenceType));
// msnMessenger.login();
}
}
else {
// Hrm, not logged in? Lets fix that.
msnMessenger.getOwner().setInitStatus(((MSNTransport)getTransport()).convertJabStatusToMSN(presenceType));
msnMessenger.login();
// // Hrm, not logged in? Lets fix that.
// msnMessenger.getOwner().setInitStatus(((MSNTransport)getTransport()).convertJabStatusToMSN(presenceType));
// msnMessenger.login();
}
}
......
......@@ -48,9 +48,6 @@ public class BOSConnection extends BasicFlapConnection {
}
protected void handleStateChange(ClientConnEvent e) {
//Log.debug("main connection state changed from "
// + e.getOldState() + " to " + e.getNewState() + ": "
// + e.getReason());
}
protected void handleFlapPacket(FlapPacketEvent e) {
......
......@@ -32,14 +32,12 @@ 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;
/**
......@@ -57,35 +55,9 @@ public abstract class BasicFlapConnection extends BaseFlapConnection {
protected int[] snacFamilies = null;
protected Collection<SnacFamilyInfo> snacFamilyInfos;
protected RateLimitingQueueMgr rateMgr = new RateLimitingQueueMgr();
protected RvProcessor rvProcessor = new RvProcessor(sp);
protected RvProcessorListener rvListener = new RvProcessorListener() {
public void handleNewSession(NewRvSessionEvent event) {
event.getSession().addListener(rvSessionListener);
}
};
protected RvSessionListener rvSessionListener = new RvSessionListener() {
public void handleRv(RecvRvEvent event) {
// RvCommand cmd = event.getRvCommand();
//
// RvSession session = event.getRvSession();
// SnacCommand snaccmd = event.getSnacCommand();
// if (!(snaccmd instanceof RecvRvIcbm)) return;
// RecvRvIcbm icbm = (RecvRvIcbm) snaccmd;
//Log.debug("got rendezvous on session <" + session + ">");
//Log.debug("- command: " + cmd);
}
public void handleSnacResponse(RvSnacResponseEvent event) {
//Log.debug("got SNAC response for <"
// + event.getRvSession() + ">: "
// + event.getSnacCommand());
}
};
{ // init
sp.setSnacQueueManager(rateMgr);
rvProcessor.registerRvCmdFactory(new DefaultRvCommandFactory());
rvProcessor.addListener(rvListener);
}
public BasicFlapConnection(String host, int port, OSCARSession mainSession, ByteBlock cookie) {
......@@ -108,20 +80,10 @@ public abstract class BasicFlapConnection extends BaseFlapConnection {
if (cmd instanceof LoginFlapCmd) {
getFlapProcessor().sendFlap(new LoginFlapCmd(cookie));
} else {
//Log.debug("got FLAP command on channel 0x"
// + Integer.toHexString(e.getFlapPacket().getChannel())
// + ": " + cmd);
}
}
protected void handleSnacPacket(SnacPacketEvent e) {
// SnacPacket packet = e.getSnacPacket();
//Log.debug("got snac packet type "
// + Integer.toHexString(packet.getFamily()) + "/"
// + Integer.toHexString(packet.getCommand()) + ": "
// + e.getSnacCommand());
SnacCommand cmd = e.getSnacCommand();
if (cmd instanceof ServerReadyCmd) {
ServerReadyCmd src = (ServerReadyCmd) cmd;
......@@ -220,21 +182,9 @@ public abstract class BasicFlapConnection extends BaseFlapConnection {
p.setFrom(oscarSession.getTransport().convertIDToJID(boc.getScreenname()));
oscarSession.getTransport().sendPacket(p);
}
else if (cmd instanceof RateChange) {
// RateChange rc = (RateChange) cmd;
//Log.debug("rate change: current avg is "
// + rc.getRateInfo().getCurrentAvg());
}
}
protected void handleSnacResponse(SnacResponseEvent e) {
// SnacPacket packet = e.getSnacPacket();
//Log.debug("got snac response type "
// + Integer.toHexString(packet.getFamily()) + "/"
// + Integer.toHexString(packet.getCommand()) + ": "
// + e.getSnacCommand());
SnacCommand cmd = e.getSnacCommand();
if (cmd instanceof RateInfoCmd) {
......
......@@ -47,24 +47,26 @@ public class LoginConnection extends BaseFlapConnection {
request(new KeyRequest(oscarSession.getRegistration().getUsername()));
}
else if (e.getNewState() == ClientFlapConn.STATE_FAILED) {
Message m = new Message();
m.setType(Message.Type.error);
m.setFrom(this.getMainSession().getTransport().getJID());
m.setTo(this.getMainSession().getJIDWithHighestPriority());
m.setBody("Connection failed: " + e.getReason());
this.getMainSession().getTransport().sendPacket(m);
this.getMainSession().logOut();
//TODO: Do we need to catch these?
// Message m = new Message();
// m.setType(Message.Type.error);
// m.setFrom(this.getMainSession().getTransport().getJID());
// m.setTo(this.getMainSession().getJIDWithHighestPriority());
// m.setBody("Connection failed: " + e.getReason());
// this.getMainSession().getTransport().sendPacket(m);
// this.getMainSession().logOut();
}
else if (e.getNewState() == ClientFlapConn.STATE_NOT_CONNECTED) {
if (!loggedin) {
Message m = new Message();
m.setType(Message.Type.error);
m.setFrom(this.getMainSession().getTransport().getJID());
m.setTo(this.getMainSession().getJIDWithHighestPriority());
m.setBody("Connection lost: " + e.getReason());
this.getMainSession().getTransport().sendPacket(m);
this.getMainSession().logOut();
}
//TODO: Do we need to catch these?
// if (!loggedin) {
// Message m = new Message();
// m.setType(Message.Type.error);
// m.setFrom(this.getMainSession().getTransport().getJID());
// m.setTo(this.getMainSession().getJIDWithHighestPriority());
// m.setBody("Connection lost: " + e.getReason());
// this.getMainSession().getTransport().sendPacket(m);
// this.getMainSession().logOut();
// }
}
}
......@@ -92,11 +94,11 @@ public class LoginConnection extends BaseFlapConnection {
int error = ar.getErrorCode();
if (error != -1) {
Log.error("connection error! code: " + error);
if (ar.getErrorUrl() != null) {
Log.error("Error URL: " + ar.getErrorUrl());
}
// Log.error("connection error! code: " + error);
// if (ar.getErrorUrl() != null) {
// Log.error("Error URL: " + ar.getErrorUrl());
// }
//
String errormsg;
switch (error) {
case (AuthResponse.ERROR_ACCOUNT_DELETED): {
......
......@@ -293,8 +293,6 @@ public class OSCARSession extends TransportSession {
} else {
// it's time to request a service
if (!(request.getCommand() instanceof ServiceRequest)) {
//Log.debug("requesting " + Integer.toHexString(family)
// + " service.");
snacMgr.setPending(family, true);
snacMgr.addRequest(request);
request(new ServiceRequest(family));
......
......@@ -17,10 +17,7 @@ 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;
......@@ -53,10 +50,6 @@ public class ServiceConnection extends BasicFlapConnection {
}
protected void handleStateChange(ClientConnEvent e) {
//Log.debug("0x" + Integer.toHexString(serviceFamily)
// + " service connection state changed to " + e.getNewState()
// + ": " + e.getReason());
if (e.getNewState() == ClientFlapConn.STATE_FAILED) {
oscarSession.serviceFailed(this);
} else if (e.getNewState() == ClientFlapConn.STATE_CONNECTED) {
......@@ -82,71 +75,6 @@ public class ServiceConnection extends BasicFlapConnection {
if (cmd instanceof RateInfoCmd) {
// this is all we need.
clientReady();
} else if (cmd instanceof InterestListCmd) {
// InterestListCmd ilc = (InterestListCmd) cmd;
//
// InterestInfo[] infos = ilc.getInterests();
//
// if (infos != null) {
// Map children = new HashMap();
//
// for (InterestInfo info1 : infos) {
// if (info1.getType() == InterestInfo.TYPE_CHILD) {
// int parentCode = info1.getParentId();
//
// List interests = (List) children.get(parentCode);
//
// if (interests == null) {
// interests = new LinkedList();
// children.put(parentCode, interests);
// }
//
// interests.add(info1);
// }
// }
// for (InterestInfo info2 : infos) {
// if (info2.getType() == InterestInfo.TYPE_PARENT) {
// Integer id = info2.getParentId();
// List interests = (List) children.get(id);
//
// //Log.debug("- " + infos[i].getName());
// if (interests != null) {
// for (Object interest : interests) {
// InterestInfo info = (InterestInfo) interest;
// //Log.debug(" - " + info.getName());
// }
// }
// }
// }
// List toplevels = (List) children.get(0);
// if (toplevels != null) {
// for (Iterator it = toplevels.iterator(); it.hasNext();) {
// //Log.debug(" "
// // + ((InterestInfo) it.next()).getName());
// }
// }
// }
} else if (cmd instanceof SearchResultsCmd) {
// SearchResultsCmd src = (SearchResultsCmd) cmd;
//
// DirInfo[] results = src.getResults();
//
// for (DirInfo result : results) {
// //Log.debug("result " + (i + 1) + ": " + results[i]);
// }
} else if (cmd instanceof IconDataCmd) {
// IconDataCmd idc = (IconDataCmd) cmd;
//
// String sn = idc.getScreenname();
//
// byte[] data = idc.getIconData().toByteArray();
// Image icon = Toolkit.getDefaultToolkit().createImage(data);
//
//// oscarSession.getUserInfo(sn).setIcon(icon);
}
}
}
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