Commit 53f441a1 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-4] Fixed issue with AIM buddy list entries not showing up. Also minor...

[GATE-4] Fixed issue with AIM buddy list entries not showing up.  Also minor logging tweak for Yahoo.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5072 b35dd754-fafc-0310-a699-88a17e54d16e
parent 762363dd
...@@ -26,6 +26,8 @@ import net.kano.joscar.ssiitem.*; ...@@ -26,6 +26,8 @@ import net.kano.joscar.ssiitem.*;
import java.net.InetAddress; import java.net.InetAddress;
import org.jivesoftware.util.Log;
/** /**
* Handles BOS related packets. * Handles BOS related packets.
* *
...@@ -121,9 +123,11 @@ public class BOSConnection extends BasicFlapConnection { ...@@ -121,9 +123,11 @@ public class BOSConnection extends BasicFlapConnection {
for (SsiItem item : items) { for (SsiItem item : items) {
SsiItemObj obj = itemFactory.getItemObj(item); SsiItemObj obj = itemFactory.getItemObj(item);
if (obj instanceof BuddyItem) { if (obj instanceof BuddyItem) {
Log.debug("AIM got buddy item " + obj);
oscarSession.gotBuddy((BuddyItem) obj); oscarSession.gotBuddy((BuddyItem) obj);
} }
else if (obj instanceof GroupItem) { else if (obj instanceof GroupItem) {
Log.debug("AIM got group item " + obj);
oscarSession.gotGroup((GroupItem) obj); oscarSession.gotGroup((GroupItem) obj);
} }
//Log.debug("- " + (obj == null ? (Object) items[i] //Log.debug("- " + (obj == null ? (Object) items[i]
......
...@@ -69,9 +69,9 @@ public class OSCARSession extends TransportSession { ...@@ -69,9 +69,9 @@ public class OSCARSession extends TransportSession {
/** /**
* SSI tracking variables. * SSI tracking variables.
*/ */
private Map<Integer,BuddyItem> buddies = new HashMap<Integer,BuddyItem>(); private Map<String,BuddyItem> buddies = new HashMap<String,BuddyItem>();
private Map<Integer,GroupItem> groups = new HashMap<Integer,GroupItem>(); private Map<Integer,GroupItem> groups = new HashMap<Integer,GroupItem>();
private Integer highestBuddyId = -1; private Map<Integer,Integer> highestBuddyIdPerGroup = new HashMap<Integer,Integer>();
private Integer highestGroupId = -1; private Integer highestGroupId = -1;
public void logIn(PresenceType presenceType, String verboseStatus) { public void logIn(PresenceType presenceType, String verboseStatus) {
...@@ -110,22 +110,32 @@ public class OSCARSession extends TransportSession { ...@@ -110,22 +110,32 @@ public class OSCARSession extends TransportSession {
* @see org.jivesoftware.wildfire.gateway.TransportSession#addContact(org.xmpp.packet.JID) * @see org.jivesoftware.wildfire.gateway.TransportSession#addContact(org.xmpp.packet.JID)
*/ */
public void addContact(JID jid) { public void addContact(JID jid) {
Integer newBuddyId = highestBuddyId + 1;
Integer groupId = -1; Integer groupId = -1;
for (GroupItem g : groups.values()) { for (GroupItem g : groups.values()) {
if ("Transport Buddies".equals(g.getGroupName())) { if ("Transport Buddies".equals(g.getGroupName())) {
groupId = g.getId(); groupId = g.getId();
} }
} }
if (groupId == -1) { if (groupId == -1) {
Integer newGroupId = highestGroupId + 1; Integer newGroupId = highestGroupId + 1;
request(new CreateItemsCmd(new SsiItem[] { GroupItem newGroup = new GroupItem("Transport Buddies", newGroupId);
new GroupItem("Transport Buddies", newGroupId).toSsiItem() })); request(new CreateItemsCmd(new SsiItem[] { newGroup.toSsiItem() }));
highestGroupId = newGroupId; highestGroupId = newGroupId;
groupId = newGroupId; groupId = newGroupId;
groups.put(groupId, newGroup);
}
Integer newBuddyId = 1;
if (highestBuddyIdPerGroup.containsKey(groupId)) {
newBuddyId = highestBuddyIdPerGroup.get(groupId) + 1;
} }
request(new CreateItemsCmd(new SsiItem[] { highestBuddyIdPerGroup.put(groupId, newBuddyId);
new BuddyItem(getTransport().convertJIDToID(jid), newBuddyId, groupId).toSsiItem() }));
BuddyItem newBuddy = new BuddyItem(getTransport().convertJIDToID(jid), newBuddyId, groupId);
request(new CreateItemsCmd(new SsiItem[] { newBuddy.toSsiItem() }));
buddies.put(groupId+"."+newBuddyId, newBuddy);
} }
/** /**
...@@ -135,7 +145,7 @@ public class OSCARSession extends TransportSession { ...@@ -135,7 +145,7 @@ public class OSCARSession extends TransportSession {
for (BuddyItem i : buddies.values()) { for (BuddyItem i : buddies.values()) {
if (i.getScreenname().equals(getTransport().convertJIDToID(jid))) { if (i.getScreenname().equals(getTransport().convertJIDToID(jid))) {
request(new DeleteItemsCmd(new SsiItem[] { i.toSsiItem() })); request(new DeleteItemsCmd(new SsiItem[] { i.toSsiItem() }));
buddies.remove(i.getId()); buddies.remove(i.getGroupId()+"."+i.getId());
} }
} }
} }
...@@ -238,9 +248,12 @@ public class OSCARSession extends TransportSession { ...@@ -238,9 +248,12 @@ public class OSCARSession extends TransportSession {
*/ */
void gotBuddy(BuddyItem buddy) { void gotBuddy(BuddyItem buddy) {
//Log.debug("Found buddy item: " + buddy.toString()); //Log.debug("Found buddy item: " + buddy.toString());
buddies.put(buddy.getId(), buddy); buddies.put(buddy.getGroupId()+"."+buddy.getId(), buddy);
if (buddy.getId() > highestBuddyId) { if (!highestBuddyIdPerGroup.containsKey(buddy.getGroupId())) {
highestBuddyId = buddy.getId(); highestBuddyIdPerGroup.put(buddy.getGroupId(), -1);
}
if (buddy.getId() > highestBuddyIdPerGroup.get(buddy.getGroupId())) {
highestBuddyIdPerGroup.put(buddy.getGroupId(), buddy.getId());
} }
} }
...@@ -252,6 +265,9 @@ public class OSCARSession extends TransportSession { ...@@ -252,6 +265,9 @@ public class OSCARSession extends TransportSession {
void gotGroup(GroupItem group) { void gotGroup(GroupItem group) {
//Log.debug("Found group item: " + group.toString()); //Log.debug("Found group item: " + group.toString());
groups.put(group.getId(), group); groups.put(group.getId(), group);
if (!highestBuddyIdPerGroup.containsKey(group.getId())) {
highestBuddyIdPerGroup.put(group.getId(), -1);
}
if (group.getId() > highestGroupId) { if (group.getId() > highestGroupId) {
highestGroupId = group.getId(); highestGroupId = group.getId();
} }
......
...@@ -136,7 +136,7 @@ public class YahooSessionListener implements SessionListener { ...@@ -136,7 +136,7 @@ public class YahooSessionListener implements SessionListener {
* @see ymsg.network.event.SessionListener#connectionClosed(ymsg.network.event.SessionEvent) * @see ymsg.network.event.SessionListener#connectionClosed(ymsg.network.event.SessionEvent)
*/ */
public void connectionClosed(SessionEvent event) { public void connectionClosed(SessionEvent event) {
Log.error(event.toString()); Log.debug(event.toString());
if (yahooSession.isLoggedIn()) { if (yahooSession.isLoggedIn()) {
yahooSession.logOut(); yahooSession.logOut();
} }
...@@ -146,7 +146,7 @@ public class YahooSessionListener implements SessionListener { ...@@ -146,7 +146,7 @@ public class YahooSessionListener implements SessionListener {
* @see ymsg.network.event.SessionListener#fileTransferReceived(ymsg.network.event.SessionFileTransferEvent) * @see ymsg.network.event.SessionListener#fileTransferReceived(ymsg.network.event.SessionFileTransferEvent)
*/ */
public void fileTransferReceived(SessionFileTransferEvent event) { public void fileTransferReceived(SessionFileTransferEvent event) {
Log.info(event.toString()); Log.debug(event.toString());
} }
...@@ -154,7 +154,7 @@ public class YahooSessionListener implements SessionListener { ...@@ -154,7 +154,7 @@ public class YahooSessionListener implements SessionListener {
* @see ymsg.network.event.SessionListener#listReceived(ymsg.network.event.SessionEvent) * @see ymsg.network.event.SessionListener#listReceived(ymsg.network.event.SessionEvent)
*/ */
public void listReceived(SessionEvent event) { public void listReceived(SessionEvent event) {
Log.info(event.toString()); Log.debug(event.toString());
} }
/** /**
......
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