Retry sending authorization reply if auth.process doesn't finnish.

cusax-fix
Damian Minkov 19 years ago
parent c5c7c263d0
commit 064fd81c36

@ -1244,6 +1244,11 @@ public void sendOfflineMessage(String buddy, String body)
{
conn.sendSnac(new OfflineSnacCmd(buddy, body));
}
void sendAuthorizationReplay(String uin, String reasonStr, boolean isAccpeted)
{
conn.sendSnac(new AuthReplyCmd(uin, reasonStr, isAccpeted));
}
private class OfflineSnacCmd extends SendImIcbm
{
@ -1371,11 +1376,12 @@ public SnacCommand genSnacCommand(SnacPacket packet)
}
logger.trace("sending authorization " + ACCEPT);
conn.sendSnac(
new AuthReplyCmd(
String.valueOf(cmd.uin),
responseReasonStr,
ACCEPT));
sendAuthorizationReplay(
String.valueOf(cmd.uin),
responseReasonStr,
ACCEPT);
return cmd;
}
else if (command == 27) // auth reply

@ -565,15 +565,10 @@ public void postTestSubscribe()
//don't want any more events
operationSetPresence.removeSubscriptionListener(subEvtCollector);
}
assertEquals("Subscription event dispatching failed."
, 1, subEvtCollector.collectedEvents.size());
// after the authorization process finished
// we must have received two events
// the first is created in NotInContactList group
// the second one is moved from NotInContactListGroup to the target group
EventObject evt =
(EventObject)subEvtCollector.collectedEvents.get(0);
@ -640,6 +635,53 @@ public void postTestSubscribe()
.removeContactPresenceStatusListener(contactPresEvtCollector);
}
if(contactPresEvtCollector.collectedEvents.size() == 0)
{
logger.info("PROBLEM. Authorisation process doesn't have finnished " +
"Server doesn't report us for changing authorization flag! Will try to authorize once again");
fixture.testerAgent.sendAuthorizationReplay(
fixture.icqAccountID.getUserID(),
fixture.testerAgent.getAuthCmdFactory().responseReasonStr,
fixture.testerAgent.getAuthCmdFactory().ACCEPT);
Object obj = new Object();
synchronized(obj)
{
logger.debug("wait for authorization process to be finnished for second time");
obj.wait(10000);
logger.debug("Stop waiting!");
}
testerAgentOldStatus = fixture.testerAgent.getPresneceStatus();
testerAgentNewStatusLong = FullUserInfo.ICQSTATUS_FFC;
//in case we are by any chance already in a FREE_FOR_CHAT status, we'll
//be changing to something else
if(testerAgentOldStatus.equals(testerAgentNewStatus)){
testerAgentNewStatus = IcqStatusEnum.OCCUPIED;
testerAgentNewStatusLong = FullUserInfo.ICQSTATUS_OCCUPIED;
}
contactPresEvtCollector.collectedEvents.clear();
operationSetPresence.addContactPresenceStatusListener(
contactPresEvtCollector);
synchronized (contactPresEvtCollector){
if (!fixture.testerAgent.enterStatus(testerAgentNewStatusLong))
{
throw new RuntimeException(
"Tester UserAgent Failed to switch to the "
+ testerAgentNewStatus.getStatusName() + " state.");
}
//we may already have the event, but it won't hurt to check.
contactPresEvtCollector.waitForEvent(12000);
operationSetPresence
.removeContactPresenceStatusListener(contactPresEvtCollector);
}
}
assertEquals("Presence Notif. event dispatching failed."
, 1, contactPresEvtCollector.collectedEvents.size());
ContactPresenceStatusChangeEvent presEvt =

Loading…
Cancel
Save