use of net.kano.joscar.snaccmd.conn.ServiceRequest in project Openfire by igniterealtime.
the class OSCARSession method handleRequest.
synchronized void handleRequest(SnacRequest request) {
Log.debug("Handling request " + request);
int family = request.getCommand().getFamily();
if (snacMgr.isPending(family)) {
snacMgr.addRequest(request);
return;
}
BasicFlapConnection conn = snacMgr.getConn(family);
if (conn != null) {
conn.sendRequest(request);
} else {
// it's time to request a service
if (!(request.getCommand() instanceof ServiceRequest)) {
snacMgr.setPending(family, true);
snacMgr.addRequest(request);
request(new ServiceRequest(family));
} else {
// TODO: Why does this occur a lot and yet not cause problems?
Log.debug("eep! can't find a service redirector server.");
}
}
}
use of net.kano.joscar.snaccmd.conn.ServiceRequest in project Openfire by igniterealtime.
the class OSCARSession method gotCompleteSSI.
/**
* Apparently we now have the entire list, lets sync.
*/
void gotCompleteSSI() {
ArrayList<Integer> nicknameRequests = new ArrayList<Integer>();
TransportBuddyManager<OSCARBuddy> manager = getBuddyManager();
for (OSCARBuddy buddy : manager.getBuddies()) {
String nickname = buddy.getNickname();
buddy.populateGroupList();
for (BuddyItem buddyItem : buddy.getBuddyItems()) {
if (buddyItem.isAwaitingAuth()) {
buddy.setAskType(RosterItem.ASK_SUBSCRIBE);
buddy.setSubType(RosterItem.SUB_NONE);
}
try {
if (nickname.equalsIgnoreCase(buddyItem.getScreenname())) {
Integer buddyUIN = Integer.parseInt(buddyItem.getScreenname());
Log.debug("REQUESTING SHORT INFO FOR " + buddyUIN);
nicknameRequests.add(buddyUIN);
}
} catch (NumberFormatException e) {
// Not an ICQ number then ;D
}
}
}
try {
getTransport().syncLegacyRoster(getJID(), getBuddyManager().getBuddies());
} catch (UserNotFoundException e) {
Log.debug("Unable to sync oscar contact list for " + getJID(), e);
}
getBuddyManager().activate();
request(new SetInfoCmd(InfoData.forCapabilities(getCapabilities())));
// if (JiveGlobals.getBooleanProperty("plugin.gateway."+getTransport().getType()+".avatars", true) && getAvatar() != null) {
// if (storedIconInfo == null || !StringUtils.encodeHex(storedIconInfo.getIconInfo().getData().toByteArray()).equals(getAvatar().getLegacyIdentifier())) {
// try {
// updateLegacyAvatar(getAvatar().getMimeType(), Base64.decode(getAvatar().getImageData()));
// }
// catch (NotFoundException e) {
// // No avatar found, moving on
// }
// }
// }
updateStatus(getPresence(), getVerboseStatus());
ssiHierarchy.setVisibilityFlag(VisibilityItem.MASK_DISABLE_RECENT_BUDDIES);
if (getTransport().getType().equals(TransportType.icq)) {
request(new OfflineMsgIcqRequest(getUIN(), (int) nextIcqId()));
}
if (JiveGlobals.getBooleanProperty("plugin.gateway." + getTransport().getType() + ".mailnotifications", true)) {
request(new ServiceRequest(MailCheckCmd.FAMILY_MAILCHECK));
}
for (Integer uin : nicknameRequests) {
MetaShortInfoRequest req = new MetaShortInfoRequest(getUIN(), (int) nextIcqId(), uin);
Log.debug("Doing a MetaShortInfoRequest for " + uin + " as " + req);
request(req);
}
}
Aggregations