Anyone else having problems modifying groups for transports in Spark?

notz wrote:

hmm,

i don’t understood the code completly here but is that line correct (in OSCARSession.java:262)?

if (buddy.getGroupId() == 0 && !grouplist.contains(DEFAULT_AIM_GROUP)) {

or should it be like this:

if (buddy.getGroupId() == 0 && !grouplist.contains(DEFAULT_AIM_GROUP) && !grouplist.contains(DEFAULT_ICQ_GROUP)) {

it seems that this change solves my icq buddy moving problem. i have to dig in further.

Hi notz, I looked back over this and remembered why I have it the way I do. The ICQ group is literally a real group, so it’s supposed to be created if it’s not there. That particular line is accounting for AIM’s default group, which is a group with id 0. (ICQ doesn’t use it the same way for some reason) So that line is explicitly looking for the AIM “main group”. So I think it’s actually correct as is. It’s interesting though that it solved your problems. I’m looking over your other patch though.

here, a small change to fix the status message on login. (icq will follow, thank you for the version hint - but i have to test it a bit more)

Index: src/java/org/jivesoftware/openfire/gateway/protocols/msn/MSNSession.java

===================================================================

— src/java/org/jivesoftware/openfire/gateway/protocols/msn/MSNSession.java (revision 8992)

+++ src/java/org/jivesoftware/openfire/gateway/protocols/msn/MSNSession.java (working copy)

@@ -406,8 +406,8 @@

public void updateStatus(PresenceType presenceType, String verboseStatus) {

if (isLoggedIn()) {

try {

  •                   msnMessenger.getOwner().setPersonalMessage(verboseStatus);
    

msnMessenger.getOwner().setStatus(((MSNTransport)getTransport()).convertXMPPSta tusToMSN(presenceType));

  •            msnMessenger.getOwner().setPersonalMessage(verboseStatus);
    

}

catch (IllegalStateException e) {

// // Hrm, not logged in? Lets fix that.

/code

that’s a patch to get icq extra status message working. but it’s still not working in away mode. any hints? the commands are the same as in pyicq.

Index: src/java/org/jivesoftware/openfire/gateway/protocols/oscar/LoginConnection.java

===================================================================

— src/java/org/jivesoftware/openfire/gateway/protocols/oscar/LoginConnection.java (revision 8992)

+++ src/java/org/jivesoftware/openfire/gateway/protocols/oscar/LoginConnection.java (working copy)

@@ -88,14 +88,24 @@

SnacCommand cmd = e.getSnacCommand();

if (cmd instanceof KeyResponse) {

  •        Log.debug("Handling AIM-style auth.");
    
  •        KeyResponse kr = (KeyResponse) cmd;
    
  •        ByteBlock authkey = kr.getKey();
    
  •        ClientVersionInfo version = new ClientVersionInfo(
    
  •        ClientVersionInfo version = null;
    
  •        if (getMainSession().getTransport().getType().equals(TransportType.icq)) {
    
  •            Log.debug("Handling ICQ-style auth.");
    
  •            version = new ClientVersionInfo(
    
  •                    "ICQBasic",
    
  •                    0x010a, 0x0014, 0x0022, 0, 0x0911, 0x0000043d);
    
  •                                           } else {
    
  •            Log.debug("Handling AIM-style auth.");
    
  •            version = new ClientVersionInfo(
    

“AOL Instant Messenger, version 5.5.3415/WIN32”,

-1, 5, 5, 0, 3415, 239);

  •        }
    
  •        KeyResponse kr = (KeyResponse) cmd;
    
  •        ByteBlock authkey = kr.getKey();
    

String pass = getMainSession().getRegistration().getPassword();

if (getMainSession().getTransport().getType().equals(TransportType.icq)) {

if (pass.length() > 8) {

Index: src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java

===================================================================

— src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java (revision 8992)

+++ src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java (working copy)

@@ -30,10 +30,13 @@

import net.kano.joscar.snaccmd.conn.SetExtraInfoCmd;

import net.kano.joscar.snaccmd.loc.SetInfoCmd;

import net.kano.joscar.snaccmd.InfoData;

+import net.kano.joscar.snaccmd.ExtraInfoBlock;

+import net.kano.joscar.snaccmd.ExtraInfoData;

import net.kano.joscar.snaccmd.CapabilityBlock;

import net.kano.joscar.snaccmd.icq.OfflineMsgIcqRequest;

import net.kano.joscar.ssiitem.BuddyItem;

import net.kano.joscar.ssiitem.GroupItem;

+import net.kano.joscar.tlv.MutableTlvChain;

import org.jivesoftware.util.JiveGlobals;

import org.jivesoftware.util.LocaleUtils;

import org.jivesoftware.util.NotFoundException;

@@ -585,7 +610,9 @@

}

else {

request(new SetInfoCmd(InfoData.forAwayMessage(InfoData.NOT_AWAY)));

  •        request(new SetExtraInfoCmd(new ExtraInfoBlock(ExtraInfoBlock.TYPE_AVAILMSG, ExtraInfoData.getAvailableMessageBlock(verboseStatus == null ? "" : verboseStatus))));
    

}

setPresenceAndStatus(presenceType, verboseStatus);

}

/code

Are you certain that ICQ -has- available message support? (just making sure) Have you seen it before? (I don’t appear to have any clients that have support for it)

jadestorm wrote:

Are you certain that ICQ -has- available message support? (just making sure) Have you seen it before? (I don’t appear to have any clients that have support for it)

hmm, is see the buddy status message with openfire and gateway plugin (also with pyicq). but setting the status is only working in pyicq - they send the same message. there have to be a difference in the login process.

Are you able to set the message using pidgin/gaim? That’s always a good place to look to contrast/compare. I know that I am not doing the “old style” authentication (that’s sorta insecure) which is on my list. Who knows, it might be possible that it’s upset about that.

i can set this message with an icq 5.1 client. but i can’t see this message on an 5.1 client. on adiumX (pidgin) i see this status message but setting doesn’t work.

i give miranda a shot tomorrow.

also authorizing/group moving is working for me with adiumX and icq.5.1. i only have to rerequest the authorization one time on icq/adium side.

before it never worked for me.

here is my last modification, which works best (need extra rerequest on icq side and away message not working).

with this version i never lost any contact, group moving always worked, authorize always worked.

Index: src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java

===================================================================

— src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java (revision 8992)

+++ src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java (working copy)

@@ -30,10 +30,13 @@

import net.kano.joscar.snaccmd.conn.SetExtraInfoCmd;

import net.kano.joscar.snaccmd.loc.SetInfoCmd;

import net.kano.joscar.snaccmd.InfoData;

+import net.kano.joscar.snaccmd.ExtraInfoBlock;

+import net.kano.joscar.snaccmd.ExtraInfoData;

import net.kano.joscar.snaccmd.CapabilityBlock;

import net.kano.joscar.snaccmd.icq.OfflineMsgIcqRequest;

import net.kano.joscar.ssiitem.BuddyItem;

import net.kano.joscar.ssiitem.GroupItem;

+import net.kano.joscar.tlv.MutableTlvChain;

import org.jivesoftware.util.JiveGlobals;

import org.jivesoftware.util.LocaleUtils;

import org.jivesoftware.util.NotFoundException;

@@ -56,7 +59,7 @@

  • Yeesh, this is the one I’m most familiar with and yet it’s the ugliest.

  • This needs some housecleaning.

  • @author Daniel Henninger

*/

public class OSCARSession extends TransportSession {

@@ -65,7 +68,7 @@

/**

  • Initialize a new session object for OSCAR

  • *
    
  • *
    
  • @param registration The registration information to use during login.

  • @param jid The JID associated with this session.

  • @param transport The transport that created this session.

@@ -85,7 +88,7 @@

private static final String DEFAULT_AIM_GROUP = " "; // We’re using 3 spaces to indicated main group, invalid in real aim

private static final String DEFAULT_ICQ_GROUP = “General”;

private SeqNum icqSeqNum = new SeqNum(0, Integer.MAX_VALUE);

/**

  • SSI tracking variables.

*/

@@ -222,6 +225,48 @@

}

// TODO: add another step here where we attempt to “move around” contacts instead of just adding and deleting

Log.debug("contact = “contact”, grouplist = "+grouplist);

  •                           OSCARBuddy oscarBuddy = null;
    
  •    try {
    
  •        oscarBuddy = (OSCARBuddy)getBuddyManager().getBuddy(getTransport().convertIDToJID(contact));
    
  •    }
    
  •    catch (NotFoundException e) {
    
  •    }
    
  •    Vector freeBuddyItems = new Vector();
    
  •    if (oscarBuddy != null) {
    
  •                                           // Now, lets clean up any groups this contact should no longer be a member of.
    
  •                                           for (BuddyItem buddy : oscarBuddy.getBuddyItems()) {
    
  •                                                           if (buddy.getScreenname().equalsIgnoreCase(contact)) {
    
  •                                                                           if (buddy.getGroupId() == 0 && !grouplist.contains(DEFAULT_AIM_GROUP)) {
    
  •                                                                            // Ok this group is the "main group", but contact isn't in it.
    
  •                                                                            Log.debug("Removing "*buddy*" from main group");
    
  •                                                                            freeBuddyItems.add(buddy);
    
  •                                                                           }
    
  •                                                                           else if (!groups.containsKey(buddy.getGroupId())) {
    
  •                                                                            // Well this is odd, a group we don't know about?  Nuke it.
    
  •                                                                            Log.debug("Removing "*buddy*" because of unknown group");
    
  •                                                                            freeBuddyItems.add(buddy);
    
  •                                                                           }
    
  •                                                                           else if (!grouplist.contains(groups.get(buddy.getGroupId()).getGroupName())) {
    
  •                                                                            Log.debug("Removing "*buddy*" because not in list of groups");
    
  •                                                                            freeBuddyItems.add(buddy);
    
  •                                                                           }
    
  •                                                                           else {
    
  •                                                                            if (buddy.getAlias() == null || !buddy.getAlias().equals(nickname)) {
    
  •                                                                            Log.debug("Updating alias for "+buddy);
    
  •                                                                            buddy.setAlias(nickname);
    
  •                                                                            request(new ModifyItemsCmd(buddy.toSsiItem()));
    
  •                                                                            oscarBuddy.tieBuddyItem(buddy, true);
    
  •                                                                            }
    
  •                                                                           }
    
  •                                                           }
    
  •                                           }
    
  •                           }
    

// First, lets take the known good list of groups and add whatever is missing on the server.

for (String group : grouplist) {

Integer groupId = getGroupIdOrCreateNew(group);

@@ -235,57 +280,37 @@

newBuddyId = highestBuddyIdPerGroup.get(groupId) + 1;

}

  •        BuddyItem newBuddy = new BuddyItem(contact, groupId, newBuddyId);
    
  •        newBuddy.setAlias(nickname);
    
  •        try {
    
  •            OSCARBuddy oscarBuddy = (OSCARBuddy)getBuddyManager().getBuddy(getTransport().convertIDToJID(contact));
    
  •            oscarBuddy.tieBuddyItem(newBuddy, true);
    
  •        if (freeBuddyItems.size() > 0) { // moving a free buddy
    
  •                   BuddyItem buddy = (BuddyItem)freeBuddyItems.get(0);
    
  •                                                           BuddyItem newBuddy = new BuddyItem(contact, groupId, newBuddyId, nickname, buddy.getBuddyComment(), buddy.getAlertWhenMask(), buddy.getAlertActionMask(), buddy.getAlertSound(), true, buddy.getExtraTlvs());
    
  •                                                           request(new DeleteItemsCmd(buddy.toSsiItem()));
    
  •                                                           oscarBuddy.removeBuddyItem(buddy.getGroupId(), false);
    
  •                                                           freeBuddyItems.remove(buddy);
    
  •                                                           oscarBuddy.tieBuddyItem(newBuddy, false);
    
  •                                                           request(new CreateItemsCmd(newBuddy.toSsiItem()));
    
  •                                           } else { // creating a new buddy
    
  •                                                           BuddyItem newBuddy = new BuddyItem(contact, groupId, newBuddyId, nickname, null, 0, 0, null, true, null);
    
  •                   newBuddy.setAlias(nickname);
    
  •                                                           if (oscarBuddy == null) {
    
  •                                                                           getBuddyManager().storeBuddy(oscarBuddy = new OSCARBuddy(getBuddyManager(), newBuddy));
    
  •                                                           } else {
    
  •                                                                           oscarBuddy.tieBuddyItem(newBuddy, false);
    
  •                                                           }
    
  •                                               request(new CreateItemsCmd(newBuddy.toSsiItem()));
    
  •            // TODO: translate this
    
  •                   request(new BuddyAuthRequest(contact, "Automated add request on behalf of user."));
    

}

  •        catch (NotFoundException e) {
    
  •            getBuddyManager().storeBuddy(new OSCARBuddy(getBuddyManager(), newBuddy));
    
  •        }
    
  •        request(new CreateItemsCmd(newBuddy.toSsiItem()));
    
  •        // TODO: translate this
    
  •        request(new BuddyAuthRequest(contact, "Automated add request on behalf of user."));
    

}

  •    OSCARBuddy oscarBuddy;
    
  •    try {
    
  •        oscarBuddy = (OSCARBuddy)getBuddyManager().getBuddy(getTransport().convertIDToJID(contact));
    
  •    }
    
  •    catch (NotFoundException e) {
    
  •        Log.error("OSCAR: Serious problem (not found in list) while syncing buddy "+contact);
    
  •        return;
    
  •    }
    
  •    // Now, lets clean up any groups this contact should no longer be a member of.
    
  •    for (BuddyItem buddy : oscarBuddy.getBuddyItems()) {
    
  •        if (buddy.getScreenname().equalsIgnoreCase(contact)) {
    
  •            if (buddy.getGroupId() == 0 && !grouplist.contains(DEFAULT_AIM_GROUP)) {
    
  •                // Ok this group is the "main group", but contact isn't in it.
    
  •                Log.debug("Removing "*buddy*" from main group");
    
  •                request(new DeleteItemsCmd(buddy.toSsiItem()));
    
  •                oscarBuddy.removeBuddyItem(buddy.getGroupId(), true);
    
  •            }
    
  •            else if (!groups.containsKey(buddy.getGroupId())) {
    
  •                // Well this is odd, a group we don't know about?  Nuke it.
    
  •                Log.debug("Removing "*buddy*" because of unknown group");
    
  •                request(new DeleteItemsCmd(buddy.toSsiItem()));
    
  •                oscarBuddy.removeBuddyItem(buddy.getGroupId(), true);
    
  •            }
    
  •            else if (!grouplist.contains(groups.get(buddy.getGroupId()).getGroupName())) {
    
  •                Log.debug("Removing "*buddy*" because not in list of groups");
    
  •                request(new DeleteItemsCmd(buddy.toSsiItem()));
    
  •                oscarBuddy.removeBuddyItem(buddy.getGroupId(), true);
    
  •            }
    
  •            else {
    
  •                if (buddy.getAlias() == null || !buddy.getAlias().equals(nickname)) {
    
  •                    Log.debug("Updating alias for "+buddy);
    
  •                    buddy.setAlias(nickname);
    
  •                    request(new ModifyItemsCmd(buddy.toSsiItem()));
    
  •                    oscarBuddy.tieBuddyItem(buddy, true);
    
  •                }
    
  •            }
    
  •        }
    
  •    }
    
  •    for (int i=0; i<freeBuddyItems.size(); i++) {
    
  •                   BuddyItem buddy = (BuddyItem)freeBuddyItems.get(i);
    
  •                   request(new DeleteItemsCmd(buddy.toSsiItem()));
    
  •                                           oscarBuddy.removeBuddyItem(buddy.getGroupId(), false);
    
  •                           }
    

}

/**

@@ -364,7 +389,7 @@

));

}

}

/**

  • @see org.jivesoftware.openfire.gateway.session.TransportSession#sendBuzzNotification (org.xmpp.packet.JID, String)

*/

@@ -571,7 +596,7 @@

*/

public void updateStatus(PresenceType presenceType, String verboseStatus) {

if (getTransport().getType().equals(TransportType.icq)) {

  •        request(new SetExtraInfoCmd(((OSCARTransport)getTransport()).convertXMPPStatusToICQ(presenc eType)));
    
  •                   request(new SetExtraInfoCmd(((OSCARTransport)getTransport()).convertXMPPStatusToICQ(presenc eType)));
    

}

if (presenceType != PresenceType.available && presenceType != PresenceType.chat) {

String awayMsg = LocaleUtils.getLocalizedString(“gateway.oscar.away”, “gateway”);

@@ -585,7 +610,9 @@

}

else {

request(new SetInfoCmd(InfoData.forAwayMessage(InfoData.NOT_AWAY)));

  •                                           request(new SetExtraInfoCmd(new ExtraInfoBlock(ExtraInfoBlock.TYPE_AVAILMSG, ExtraInfoData.getAvailableMessageBlock(verboseStatus == null ? "" : verboseStatus))));
    

}

setPresenceAndStatus(presenceType, verboseStatus);

}

/code

Thanks man =) I’m probably going to do some efficiency tweaks here and there on it before putting it into the plugin, but I’ll make sure to get it into 1.1.2. Great work!

hy,

thank you for commiting my patch, but i my last diff was a important change and also your modification is not working as it should. you can not use the modify command because you always get RESULT_ID_TAKEN back.

2007.08.27 09:49:51 Sending SNAC command: ModifyItemsCmd: 1 items:

2007.08.27 09:49:51 OSCAR bos snac response received: SnacResponseEvent: request=SnacRequest for ModifyItemsCmd: 1 items: : listeners: , responses: null - SnacPacketEvent: snacProcessor=ClientSnacProcessor: lastreqid=15, requests: 15, paused=false, snacPacket=SnacPacket type 0x13/0xe, flag1=0x80: 2 bytes (id=15), snacCommand=SsiDataModAck: results=0xa (RESULT_ID_TAKEN) - FlapPacketEvent: flapProcessor=FlapProcessor: seqNum=SeqNum: min=0, max=65535, last(current)=16, flapCommand=SnacFlapCmd: packet=SnacPacket type 0x13/0xe, flag1=0x80: 10 bytes (id=15), flapPacket=FlapPacket (channel=2, seq=30090)

/code

i merged your last changes and made a diff again:

Index: src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java

===================================================================

— src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java (revision 9006)

+++ src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java (working copy)

@@ -288,16 +288,19 @@

// Moving a freed buddy item

BuddyItem buddy = freeBuddyItems.remove(0);

oscarBuddy.removeBuddyItem(buddy.getGroupId(), false);

  •            request(new DeleteItemsCmd(buddy.toSsiItem()));
    

buddy.setGroupid(groupId);

buddy.setId(newBuddyId);

buddy.setAlias(nickname);

  •            request(new ModifyItemsCmd(buddy.toSsiItem()));
    
  •            buddy.setAwaitingAuth(true);
    
  •            request(new CreateItemsCmd(buddy.toSsiItem()));
    

oscarBuddy.tieBuddyItem(buddy, false);

}

else {

// Creating a new buddy item

BuddyItem newBuddy = new BuddyItem(contact, groupId, newBuddyId);

newBuddy.setAlias(nickname);

  •            newBuddy.setAwaitingAuth(true);
    

request(new CreateItemsCmd(newBuddy.toSsiItem()));

if (oscarBuddy == null) {

oscarBuddy = new OSCARBuddy(getBuddyManager(), newBuddy);

/code

so no buddy get lost, but you need to reauth the buddies if the have turned on that autorisation is required.

normaly, whe should not set “buddy.setAwaitingAuth(true);” on moving. but if i not set this, my buddy always got deleted (RESULT_ICQ_AUTH_REQUIRED - and the entry is not storred - pidgin gets RESULT_SUCCESS).

i sniffed the packets from pidgin and the gateway plugin. both sends the same packets, but pidgin always waits for the ack to send the next modification. the gateway plugins sends all modifications and gets afterwards the response. i don’t understand your pendingSnac code, but i think it should handle this or? (then it seems not to work correct).

notz wrote:

hy,

thank you for commiting my patch, but i my last diff was a important change and also your modification is not working as it should. you can not use the modify command because you always get RESULT_ID_TAKEN back.

2007.08.27 09:49:51 Sending SNAC command: ModifyItemsCmd: 1 items:

2007.08.27 09:49:51 OSCAR bos snac response received: SnacResponseEvent: request=SnacRequest for ModifyItemsCmd: 1 items: : listeners: , responses: null - SnacPacketEvent: snacProcessor=ClientSnacProcessor: lastreqid=15, requests: 15, paused=false, snacPacket=SnacPacket type 0x13/0xe, flag1=0x80: 2 bytes (id=15), snacCommand=SsiDataModAck: results=0xa (RESULT_ID_TAKEN) - FlapPacketEvent: flapProcessor=FlapProcessor: seqNum=SeqNum: min=0, max=65535, last(current)=16, flapCommand=SnacFlapCmd: packet=SnacPacket type 0x13/0xe, flag1=0x80: 10 bytes (id=15), flapPacket=FlapPacket (channel=2, seq=30090)

/code

Result ID taken sounds like that modifications to the buddy item itself aren’t doing what they’re supposed to. And you know what, I think I know why. (in other words, modify -should- work just fine, it looks like I’m just not doing it right, so to speak)

i merged your last changes and made a diff again:

Index: src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java

===================================================================

— src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java (revision 9006)

+++ src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java (working copy)

@@ -288,16 +288,19 @@

// Moving a freed buddy item

BuddyItem buddy = freeBuddyItems.remove(0);

oscarBuddy.removeBuddyItem(buddy.getGroupId(), false);

  •            request(new DeleteItemsCmd(buddy.toSsiItem()));
    

buddy.setGroupid(groupId);

buddy.setId(newBuddyId);

buddy.setAlias(nickname);

  •            request(new ModifyItemsCmd(buddy.toSsiItem()));
    
  •            buddy.setAwaitingAuth(true);
    
  •            request(new CreateItemsCmd(buddy.toSsiItem()));
    

oscarBuddy.tieBuddyItem(buddy, false);

}

else {

// Creating a new buddy item

BuddyItem newBuddy = new BuddyItem(contact, groupId, newBuddyId);

newBuddy.setAlias(nickname);

  •            newBuddy.setAwaitingAuth(true);
    

request(new CreateItemsCmd(newBuddy.toSsiItem()));

if (oscarBuddy == null) {

oscarBuddy = new OSCARBuddy(getBuddyManager(), newBuddy);

/code

so no buddy get lost, but you need to reauth the buddies if the have turned on that autorisation is required.

normaly, whe should not set “buddy.setAwaitingAuth(true);” on moving. but if i not set this, my buddy always got deleted (RESULT_ICQ_AUTH_REQUIRED - and the entry is not storred - pidgin gets RESULT_SUCCESS).

Which makes sense since you aren’t modifying, you are deleting and then adding. If we can modify, we don’t need the awaiting auth. (well, except for a brand new item) I think we only have to set it when we’re dealing with ICQ as well. (note that we have to compensate for AIM and ICQ differences in some cases)

i sniffed the packets from pidgin and the gateway plugin. both sends the same packets, but pidgin always waits for the ack to send the next modification. the gateway plugins sends all modifications and gets afterwards the response. i don’t understand your pendingSnac code, but i think it should handle this or? (then it seems not to work correct).

I’d sniffed a couple others in the past (like AIM) and actually have seen them spew all of the changes in one fell swoop without waiting for responses. So there is a precedent for that behavior at least. =) I’m not worried about waiting on the responses right now. Let me do some tweaks and see what I can find.

Daniel

jadestorm wrote:

I’d sniffed a couple others in the past (like AIM) and actually have seen them spew all of the changes in one fell swoop without waiting for responses. So there is a precedent for that behavior at least. =) I’m not worried about waiting on the responses right now. Let me do some tweaks and see what I can find.

you are right, tried now the send the commands after receiving the ack, but the result is the same. hmm, so there is no diffrence between pidgin and the gateway plugin in this part.

hy,

perhaps i found the difference between pidgin and the gateway plugin. i read for got moving working the order of the tlv’s have to be the same. but the joscar library changes the order, because on creating of the BuddyItem from a SsiItem some tlv’s got removed and where added (at the end) on generating the SsiItem again.

extraTlvs.removeTlvs(TYPE_ALIAS, TYPE_COMMENT, TYPE_ALERT_SOUND,

TYPE_ALERT_FLAGS, TYPE_AWAITING_AUTH);

/code

for testing it should be enough to uncomment these two lines. i’d like to try that, but if i’m right, you are using a patched svn version. so please can you email me you snapshot?

Can you re-contact me at my email address and I’ll make it available to you? (I don’t have your email handy at the moment)

thank you for the snapshot - i got it now working also for contacts that need authorization.

here the patch to svn:

first we need to send a PreModCmd & PostModCmd - like pidgin does. also i think it is not neccesery to check in this loop oscarBuddy against null. because freeBuddyItems.size() can only be greater than 0 if it is not null.

Index: src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java

===================================================================

— src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java (revision 9022)

+++ src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java (working copy)

@@ -24,6 +24,8 @@

import net.kano.joscar.snaccmd.ssi.DeleteItemsCmd;

import net.kano.joscar.snaccmd.ssi.ModifyItemsCmd;

import net.kano.joscar.snaccmd.ssi.BuddyAuthRequest;

+import net.kano.joscar.snaccmd.ssi.PostModCmd;

+import net.kano.joscar.snaccmd.ssi.PreModCmd;

import net.kano.joscar.snaccmd.icbm.SendImIcbm;

import net.kano.joscar.snaccmd.icbm.SendTypingNotification;

import net.kano.joscar.snaccmd.conn.ServiceRequest;

@@ -297,6 +299,9 @@

}

if (freeBuddyItems.size() > 0) {

  •             request(new PreModCmd());
    

// Moving a freed buddy item

// TODO: This isn’t working… why? Returns RESULT_ID_TAKEN

// BuddyItem buddy = freeBuddyItems.remove(0);

@@ -320,21 +325,13 @@

BuddyItem newBuddy = new BuddyItem(buddy);

newBuddy.setGroupid(groupId);

newBuddy.setId(newBuddyId);

  •            buddy.setAlias(nickname);
    
  •            //buddy.setAlias(nickname);
    

request(new DeleteItemsCmd(buddy.toSsiItem()));

  •            if (oscarBuddy != null) {
    
  •                oscarBuddy.removeBuddyItem(buddy.getGroupId(), false);
    
  •            }
    
  •            oscarBuddy.removeBuddyItem(buddy.getGroupId(), false);
    

request(new CreateItemsCmd(newBuddy.toSsiItem()));

  •            if (oscarBuddy == null) {
    
  •                oscarBuddy = new OSCARBuddy(getBuddyManager(), newBuddy);
    
  •                getBuddyManager().storeBuddy(oscarBuddy);
    
  •                // TODO: translate this
    
  •                request(new BuddyAuthRequest(contact, "Automated add request on behalf of user."));
    
  •            }
    
  •            else {
    
  •                oscarBuddy.tieBuddyItem(newBuddy, false);
    
  •            }
    
  •            oscarBuddy.tieBuddyItem(newBuddy, false);
    
  •            request(new PostModCmd());
    

}

else {

// Creating a new buddy item

/code

second we have to modify in the joscar lib the BuddyItem, because we have to keep the right order.

— protocol/src/net/kano/joscar/ssiitem/BuddyItem.java 2007-02-05 00:12:31.000000000 +0100

+++ …/…/joscar/protocol/src/net/kano/joscar/ssiitem/BuddyItem.java 2007-08-28 10:39:52.399875794 +0200

@@ -155,10 +155,6 @@

awaitingAuth = chain.hasTlv(TYPE_AWAITING_AUTH);

MutableTlvChain extraTlvs = TlvTools.getMutableCopy(chain);

  •    extraTlvs.removeTlvs(TYPE_ALIAS, TYPE_COMMENT, TYPE_ALERT_SOUND,
    
  •            TYPE_ALERT_FLAGS, TYPE_AWAITING_AUTH);
    

addExtraTlvs(extraTlvs);

}

@@ -425,13 +421,17 @@

}

public synchronized SsiItem toSsiItem() {

  •    MutableTlvChain chain = TlvTools.createMutableChain();
    
  •    MutableTlvChain chain = (MutableTlvChain)copyExtraTlvs();
    

if (alias != null) {

  •        chain.addTlv(Tlv.getUtf8Instance(TYPE_ALIAS, alias));
    
  •        chain.replaceTlv(Tlv.getUtf8Instance(TYPE_ALIAS, alias));
    
  •    } else {
    
  •        chain.removeTlvs(TYPE_ALIAS);
    

}

if (comment != null) {

  •        chain.addTlv(Tlv.getUtf8Instance(TYPE_COMMENT, comment));
    
  •        chain.replaceTlv(Tlv.getUtf8Instance(TYPE_COMMENT, comment));
    
  •    } else {
    
  •        chain.removeTlvs(TYPE_COMMENT);
    

}

if (alertActionMask != 0 || alertWhenMask != 0) {

// this is the most elegant statement I’ve ever written.

@@ -439,17 +439,24 @@

BinaryTools.getUByte(alertActionMask)[0],

BinaryTools.getUByte(alertWhenMask)[0]

});

  •        chain.addTlv(new Tlv(TYPE_ALERT_FLAGS, block));
    
  •        chain.replaceTlv(new Tlv(TYPE_ALERT_FLAGS, block));
    
  •    } else {
    
  •        chain.removeTlvs(TYPE_ALERT_FLAGS);
    

}

if (alertSound != null) {

  •        chain.addTlv(Tlv.getStringInstance(TYPE_ALERT_SOUND, alertSound));
    
  •        chain.replaceTlv(Tlv.getStringInstance(TYPE_ALERT_SOUND, alertSound));
    
  •    } else {
    
  •        chain.removeTlvs(TYPE_ALERT_SOUND);
    

}

if (awaitingAuth) {

  •        chain.addTlv(new Tlv(TYPE_AWAITING_AUTH));
    
  •        chain.replaceTlv(new Tlv(TYPE_AWAITING_AUTH));
    
  •    } else {
    
  •        chain.removeTlvs(TYPE_AWAITING_AUTH);
    

}

  •    return generateItem(sn, groupid, id, SsiItem.TYPE_BUDDY, chain);
    
  •    return new SsiItem(sn, groupid, id, SsiItem.TYPE_BUDDY,
    
  •            ByteBlock.createByteBlock(chain));
    

}

public synchronized String toString() {

/code

you should include this patch in 1.1.2 - because othwerwise it’s not working with contacts that needs authorization.

also you settting the nickname to the old buddy - buddy.setAlias(nickname) - but in this section we are not allowed to change the nickname, because moving will fail.

notz wrote:

thank you for the snapshot - i got it now working also for contacts that need authorization.

here the patch to svn:

first we need to send a PreModCmd & PostModCmd - like pidgin does. also i think it is not neccesery to check in this loop oscarBuddy against null. because freeBuddyItems.size() can only be greater than 0 if it is not null.

I check oscarBuddy “just in case”. besides, it shuts up intellij.

And crap, I forgot about the PreMod and PostMod commands! I wonder why changes have been working without them though? Maybe ICQ requires the pre and post and AIM doesn’t. I tested extensively with AIM but not ICQ.

Index: src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java

===================================================================

— src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java (revision 9022)

+++ src/java/org/jivesoftware/openfire/gateway/protocols/oscar/OSCARSession.java (working copy)

@@ -24,6 +24,8 @@

import net.kano.joscar.snaccmd.ssi.DeleteItemsCmd;

import net.kano.joscar.snaccmd.ssi.ModifyItemsCmd;

import net.kano.joscar.snaccmd.ssi.BuddyAuthRequest;

+import net.kano.joscar.snaccmd.ssi.PostModCmd;

+import net.kano.joscar.snaccmd.ssi.PreModCmd;

import net.kano.joscar.snaccmd.icbm.SendImIcbm;

import net.kano.joscar.snaccmd.icbm.SendTypingNotification;

import net.kano.joscar.snaccmd.conn.ServiceRequest;

@@ -297,6 +299,9 @@

}

if (freeBuddyItems.size() > 0) {

  •             request(new PreModCmd());
    

// Moving a freed buddy item

// TODO: This isn’t working… why? Returns RESULT_ID_TAKEN

// BuddyItem buddy = freeBuddyItems.remove(0);

@@ -320,21 +325,13 @@

BuddyItem newBuddy = new BuddyItem(buddy);

newBuddy.setGroupid(groupId);

newBuddy.setId(newBuddyId);

  •            buddy.setAlias(nickname);
    
  •            //buddy.setAlias(nickname);
    

request(new DeleteItemsCmd(buddy.toSsiItem()));

  •            if (oscarBuddy != null) {
    
  •                oscarBuddy.removeBuddyItem(buddy.getGroupId(), false);
    
  •            }
    
  •            oscarBuddy.removeBuddyItem(buddy.getGroupId(), false);
    

request(new CreateItemsCmd(newBuddy.toSsiItem()));

  •            if (oscarBuddy == null) {
    
  •                oscarBuddy = new OSCARBuddy(getBuddyManager(), newBuddy);
    
  •                getBuddyManager().storeBuddy(oscarBuddy);
    
  •                // TODO: translate this
    
  •                request(new BuddyAuthRequest(contact, "Automated add request on behalf of user."));
    
  •            }
    
  •            else {
    
  •                oscarBuddy.tieBuddyItem(newBuddy, false);
    
  •            }
    
  •            oscarBuddy.tieBuddyItem(newBuddy, false);
    
  •            request(new PostModCmd());
    

}

else {

// Creating a new buddy item

/code

second we have to modify in the joscar lib the BuddyItem, because we have to keep the right order.

— protocol/src/net/kano/joscar/ssiitem/BuddyItem.java 2007-02-05 00:12:31.000000000 +0100

+++ …/…/joscar/protocol/src/net/kano/joscar/ssiitem/BuddyItem.java 2007-08-28 10:39:52.399875794 +0200

@@ -155,10 +155,6 @@

awaitingAuth = chain.hasTlv(TYPE_AWAITING_AUTH);

MutableTlvChain extraTlvs = TlvTools.getMutableCopy(chain);

  •    extraTlvs.removeTlvs(TYPE_ALIAS, TYPE_COMMENT, TYPE_ALERT_SOUND,
    
  •            TYPE_ALERT_FLAGS, TYPE_AWAITING_AUTH);
    

addExtraTlvs(extraTlvs);

}

@@ -425,13 +421,17 @@

}

public synchronized SsiItem toSsiItem() {

  •    MutableTlvChain chain = TlvTools.createMutableChain();
    
  •    MutableTlvChain chain = (MutableTlvChain)copyExtraTlvs();
    

if (alias != null) {

  •        chain.addTlv(Tlv.getUtf8Instance(TYPE_ALIAS, alias));
    
  •        chain.replaceTlv(Tlv.getUtf8Instance(TYPE_ALIAS, alias));
    
  •    } else {
    
  •        chain.removeTlvs(TYPE_ALIAS);
    

}

if (comment != null) {

  •        chain.addTlv(Tlv.getUtf8Instance(TYPE_COMMENT, comment));
    
  •        chain.replaceTlv(Tlv.getUtf8Instance(TYPE_COMMENT, comment));
    
  •    } else {
    
  •        chain.removeTlvs(TYPE_COMMENT);
    

}

if (alertActionMask != 0 || alertWhenMask != 0) {

// this is the most elegant statement I’ve ever written.

@@ -439,17 +439,24 @@

BinaryTools.getUByte(alertActionMask)[0],

BinaryTools.getUByte(alertWhenMask)[0]

});

  •        chain.addTlv(new Tlv(TYPE_ALERT_FLAGS, block));
    
  •        chain.replaceTlv(new Tlv(TYPE_ALERT_FLAGS, block));
    
  •    } else {
    
  •        chain.removeTlvs(TYPE_ALERT_FLAGS);
    

}

if (alertSound != null) {

  •        chain.addTlv(Tlv.getStringInstance(TYPE_ALERT_SOUND, alertSound));
    
  •        chain.replaceTlv(Tlv.getStringInstance(TYPE_ALERT_SOUND, alertSound));
    
  •    } else {
    
  •        chain.removeTlvs(TYPE_ALERT_SOUND);
    

}

if (awaitingAuth) {

  •        chain.addTlv(new Tlv(TYPE_AWAITING_AUTH));
    
  •        chain.replaceTlv(new Tlv(TYPE_AWAITING_AUTH));
    
  •    } else {
    
  •        chain.removeTlvs(TYPE_AWAITING_AUTH);
    

}

  •    return generateItem(sn, groupid, id, SsiItem.TYPE_BUDDY, chain);
    
  •    return new SsiItem(sn, groupid, id, SsiItem.TYPE_BUDDY,
    
  •            ByteBlock.createByteBlock(chain));
    

}

public synchronized String toString() {

/code

you should include this patch in 1.1.2 - because othwerwise it’s not working with contacts that needs authorization.

also you settting the nickname to the old buddy - buddy.setAlias(nickname) - but in this section we are not allowed to change the nickname, because moving will fail.

I’m definitely doing the wrong nickname set there. newBuddy was supposed to be the one to get it’s nickname set. It appears that AIM is more lenient than ICQ on this front.

Anyway, I’ll take a look real quick and tweak the 1.1.2 release before actually really putting it out. Thanks!

thank you, for aplying that patch.

further i have on more issue on adding a buddy.

first we have to update the internal buddyItem with each ModifyItemCmd (because updating will fail, if we don’t have the correct tlv’s) and second i think we have to handle the AuthReplyRequest in the handleSnacPacket listener. it’s currently unhandeld

that is what i get after acception of the auth request on the other side:

2007.08.28 16:59:09 OSCAR bos snac packet received: SnacPacketEvent: snacProcessor=ClientSnacProcessor: lastreqid=30, requests: 30, paused=false, snacPacket=SnacPacket type 0x13/0x1b, flag1=0x80: 15 bytes (id=2402748736), snacCommand=net.kano.joscar.snaccmd.ssi.AuthReplyCmd@1b6a350 - FlapPacketEvent: flapProcessor=FlapProcessor: seqNum=SeqNum: min=0, max=65535, last(current)=31, flapCommand=SnacFlapCmd: packet=SnacPacket type 0x13/0x1b, flag1=0x80: 23 bytes (id=2402748736), flapPacket=FlapPacket (channel=2, seq=17197)

2007.08.28 16:59:09 OSCAR snac packet received: SnacPacketEvent: snacProcessor=ClientSnacProcessor: lastreqid=30, requests: 30, paused=false, snacPacket=SnacPacket type 0x13/0x1b, flag1=0x80: 15 bytes (id=2402748736), snacCommand=net.kano.joscar.snaccmd.ssi.AuthReplyCmd@1b6a350 - FlapPacketEvent: flapProcessor=FlapProcessor: seqNum=SeqNum: min=0, max=65535, last(current)=31, flapCommand=SnacFlapCmd: packet=SnacPacket type 0x13/0x1b, flag1=0x80: 23 bytes (id=2402748736), flapPacket=FlapPacket (channel=2, seq=17197)

2007.08.28 16:59:09 OSCAR bos snac packet received: SnacPacketEvent: snacProcessor=ClientSnacProcessor: lastreqid=30, requests: 30, paused=false, snacPacket=SnacPacket type 0x13/0x11, flag1=0x80: 0 bytes (id=2402748751), snacCommand=PreModCmd - FlapPacketEvent: flapProcessor=FlapProcessor: seqNum=SeqNum: min=0, max=65535, last(current)=31, flapCommand=SnacFlapCmd: packet=SnacPacket type 0x13/0x11, flag1=0x80: 8 bytes (id=2402748751), flapPacket=FlapPacket (channel=2, seq=17198)

2007.08.28 16:59:09 OSCAR snac packet received: SnacPacketEvent: snacProcessor=ClientSnacProcessor: lastreqid=30, requests: 30, paused=false, snacPacket=SnacPacket type 0x13/0x11, flag1=0x80: 0 bytes (id=2402748751), snacCommand=PreModCmd - FlapPacketEvent: flapProcessor=FlapProcessor: seqNum=SeqNum: min=0, max=65535, last(current)=31, flapCommand=SnacFlapCmd: packet=SnacPacket type 0x13/0x11, flag1=0x80: 8 bytes (id=2402748751), flapPacket=FlapPacket (channel=2, seq=17198)

2007.08.28 16:59:09 OSCAR bos snac packet received: SnacPacketEvent: snacProcessor=ClientSnacProcessor: lastreqid=30, requests: 30, paused=false, snacPacket=SnacPacket type 0x13/0x9, flag1=0x80: 76 bytes (id=2402748752), snacCommand=ModifyItemsCmd: 1 items: - FlapPacketEvent: flapProcessor=FlapProcessor: seqNum=SeqNum: min=0, max=65535, last(current)=31, flapCommand=SnacFlapCmd: packet=SnacPacket type 0x13/0x9, flag1=0x80: 84 bytes (id=2402748752), flapPacket=FlapPacket (channel=2, seq=17199)

2007.08.28 16:59:09 OSCAR snac packet received: SnacPacketEvent: snacProcessor=ClientSnacProcessor: lastreqid=30, requests: 30, paused=false, snacPacket=SnacPacket type 0x13/0x9, flag1=0x80: 76 bytes (id=2402748752), snacCommand=ModifyItemsCmd: 1 items: - FlapPacketEvent: flapProcessor=FlapProcessor: seqNum=SeqNum: min=0, max=65535, last(current)=31, flapCommand=SnacFlapCmd: packet=SnacPacket type 0x13/0x9, flag1=0x80: 84 bytes (id=2402748752), flapPacket=FlapPacket (channel=2, seq=17199)

2007.08.28 16:59:09 OSCAR bos snac packet received: SnacPacketEvent: snacProcessor=ClientSnacProcessor: lastreqid=30, requests: 30, paused=false, snacPacket=SnacPacket type 0x13/0x12, flag1=0x80: 0 bytes (id=2402748753), snacCommand=PostModCmd - FlapPacketEvent: flapProcessor=FlapProcessor: seqNum=SeqNum: min=0, max=65535, last(current)=31, flapCommand=SnacFlapCmd: packet=SnacPacket type 0x13/0x12, flag1=0x80: 8 bytes (id=2402748753), flapPacket=FlapPacket (channel=2, seq=17200)

2007.08.28 16:59:09 OSCAR snac packet received: SnacPacketEvent: snacProcessor=ClientSnacProcessor: lastreqid=30, requests: 30, paused=false, snacPacket=SnacPacket type 0x13/0x12, flag1=0x80: 0 bytes (id=2402748753), snacCommand=PostModCmd - FlapPacketEvent: flapProcessor=FlapProcessor: seqNum=SeqNum: min=0, max=65535, last(current)=31, flapCommand=SnacFlapCmd: packet=SnacPacket type 0x13/0x12, flag1=0x80: 8 bytes (id=2402748753), flapPacket=FlapPacket (channel=2, seq=17200)

2007.08.28 16:59:09 OSCAR bos snac packet received: SnacPacketEvent: snacProcessor=ClientSnacProcessor: lastreqid=30, requests: 30, paused=false, snacPacket=SnacPacket type 0x3/0xb: 177 bytes (id=2402748789), snacCommand=BuddyStatusCmd: userinfo=UserInfo for 433042016: flags=0x50 (MASK_FREE | 0x40), ICQ status=, memberSince=Mon Mar 05 11:52:05 CET 2007, sessLenAim=9min, onSince=Tue Aug 28 16:49:47 CEST 2007, extraTlvs=[TLV: type=0xc, length=37, ascii value=" “: 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00, TLV: type=0xa, length=4, ascii value=” ", uint value=0: 00 00 00 00, TLV: type=0x26, length=4, uint value=1186559206: 46 b9 74 e6], longcaps: [] - FlapPacketEvent: flapProcessor=FlapProcessor: seqNum=SeqNum: min=0, max=65535, last(current)=31, flapCommand=SnacFlapCmd: packet=SnacPacket type 0x3/0xb: 177 bytes (id=2402748789), flapPacket=FlapPacket (channel=2, seq=17201)

2007.08.28 16:59:09 OSCAR snac packet received: SnacPacketEvent: snacProcessor=ClientSnacProcessor: lastreqid=30, requests: 30, paused=false, snacPacket=SnacPacket type 0x3/0xb: 177 bytes (id=2402748789), snacCommand=BuddyStatusCmd: userinfo=UserInfo for 433042016: flags=0x50 (MASK_FREE | 0x40), ICQ status=, memberSince=Mon Mar 05 11:52:05 CET 2007, sessLenAim=9min, onSince=Tue Aug 28 16:49:47 CEST 2007, extraTlvs=[TLV: type=0xc, length=37, ascii value=" “: 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00, TLV: type=0xa, length=4, ascii value=” ", uint value=0: 00 00 00 00, TLV: type=0x26, length=4, uint value=1186559206: 46 b9 74 e6], longcaps: [] - FlapPacketEvent: flapProcessor=FlapProcessor: seqNum=SeqNum: min=0, max=65535, last(current)=31, flapCommand=SnacFlapCmd: packet=SnacPacket type 0x3/0xb: 177 bytes (id=2402748789), flapPacket=FlapPacket (channel=2, seq=17201)

/code

is that correct ? then i will make a patch for that.

hmm, with that modifications it work much better.

— src/java/org/jivesoftware/openfire/gateway/protocols/oscar/BOSConnection.java (revision 9023)

+++ src/java/org/jivesoftware/openfire/gateway/protocols/oscar/BOSConnection.java (working copy)

@@ -109,6 +109,59 @@

// TODO: Evaluate handling this in a non-automated fashion.

request(new AuthReplyCmd(bar.getScreenname(), null, true));

}

  •    else if (cmd instanceof AuthReplyCmd) {
    
  •        AuthReplyCmd ar = (AuthReplyCmd)cmd;
    
  •        if (ar.isAccepted()) {
    
  •            Presence p = new Presence();
    
  •            p.setType(Presence.Type.subscribed);
    
  •            p.setTo(getMainSession().getJID());
    
  •            p.setFrom(getMainSession().getTransport().convertIDToJID(ar.getSender()));
    
  •            getMainSession().getTransport().sendPacket(p);
    
  •            try {
    
  •                // Lets try to complete the process.
    
  •                Roster roster = getMainSession().getTransport().getRosterManager().getRoster(getMainSession().g etJID().getNode());
    
  •                RosterItem gwitem = roster.getRosterItem(getMainSession().getTransport().convertIDToJID(ar.getSende r()));
    
  •                getMainSession().addContact(gwitem);
    
  •            }
    
  •            catch (UserNotFoundException ee) {
    
  •                // Ok, I guess we're going to have to let the subscribed packet to it's thing.
    
  •            }
    
  •        }
    
  •        else {
    
  •            Presence p = new Presence();
    
  •            p.setType(Presence.Type.unsubscribed);
    
  •            p.setTo(getMainSession().getJID());
    
  •            p.setFrom(getMainSession().getTransport().convertIDToJID(ar.getSender()));
    
  •            getMainSession().getTransport().sendPacket(p);
    
  •        }
    
  •    }
    
  •    else if (cmd instanceof ModifyItemsCmd) {
    
  •        ModifyItemsCmd mic = (ModifyItemsCmd) cmd;
    
  •        List items = mic.getItems();
    
  •        for (SsiItem item : items) {
    
  •            SsiItemObj obj = itemFactory.getItemObj(item);
    
  •            if (obj instanceof BuddyItem) {
    
  •                BuddyItem bi = (BuddyItem)obj;
    
  •                Log.debug("AIM got buddy item " + bi);
    
  •                try {
    
  •                    OSCARBuddy oscarBuddy = (OSCARBuddy)getMainSession().getBuddyManager().getBuddy(getMainSession().getTra nsport().convertIDToJID(bi.getScreenname()));
    
  •                    oscarBuddy.tieBuddyItem(bi, false);
    
  •                }
    
  •                catch (NotFoundException ee) {
    
  •                    OSCARBuddy oscarBuddy = new OSCARBuddy(getMainSession().getBuddyManager(), bi);
    
  •                    getMainSession().getBuddyManager().storeBuddy(oscarBuddy);
    
  •                }
    
  •            }
    
  •            else if (obj instanceof GroupItem) {
    
  •                GroupItem gi = (GroupItem)obj;
    
  •                Log.debug("AIM got group item " + gi);
    
  •                getMainSession().gotGroup(gi);
    
  •            }
    
  •        }
    
  •    }
    

}

protected void handleSnacResponse(SnacResponseEvent e) {

/code

only this seems not to work, i always have to rerequest the authorization, to got authorized.

// Auto-accept auth request. (for now)

// TODO: Evaluate handling this in a non-automated fashion.

request(new AuthReplyCmd(bar.getScreenname(), null, true));

/code

Hi notz, I’m a little confused about what’s going on here. You copied a couple of parts from the SNAC response handler and that’s helping? Would you mind running through the logistics with me a bit? (I’m going to go ahead and release 1.1.2 and we can look at this for 1.1.3)

yes, because you get an ModifyItemsCmd if something has changed on icq side (like got authorization) and we need to update the internal BuddyItem to reflect the new tlv’s. the command is nearly the same as SsiItemsCmd you get when you request the server side roster. the modify command is not requested by you so it’s not going to the response listener.

also the AuthRequestCmd is not a direct response so it also comes in the packet listener.

i think it’s important to add the ModifyItemCmd handling to 1.1.2. because if anything has changed since you have logged in, the move can fail (if the other contact requires auth) and it’s resulting in lost contact.