diff options
-rwxr-xr-x | protocols/JabberG/src/jabber_misc.cpp | 8 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_proto.cpp | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index ed77e4595a..f41edad6c6 100755 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -207,8 +207,10 @@ void CJabberProto::ResolveTransportNicks(const char *jid) void CJabberProto::SetServerStatus(int iNewStatus)
{
- if (!m_bJabberOnline)
+ if (!m_bJabberOnline) {
+ m_iDesiredStatus = m_iStatus;
return;
+ }
// change status
int oldStatus = m_iStatus;
@@ -230,8 +232,10 @@ void CJabberProto::SetServerStatus(int iNewStatus) return;
}
- if (m_iStatus == oldStatus)
+ if (m_iStatus == oldStatus) {
+ m_iDesiredStatus = m_iStatus;
return;
+ }
// send presence update
SendPresence(m_iStatus, true);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 752ae2cda8..3ac61aec58 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -1118,8 +1118,11 @@ int CJabberProto::SetStatus(int iNewStatus) }
else if (m_bJabberOnline)
SetServerStatus(iNewStatus);
- else
- ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
+ else {
+ // race condition: old thread is dying, but we're already offline. report failure
+ m_iDesiredStatus = oldStatus;
+ ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_FAILED, (HANDLE)oldStatus, m_iStatus);
+ }
return 0;
}
|