void FXmppPresenceJingle::OnSignalPresenceUpdate(const buzz::PresenceStatus& InStatus) { // ignore muc presence FString Domain(UTF8_TO_TCHAR(InStatus.jid().domain().c_str())); if (!Domain.Equals(Connection.GetMucDomain(), ESearchCase::IgnoreCase)) { FXmppUserJid UserJid; FXmppJingle::ConvertToJid(UserJid, InStatus.jid()); // Don't keep presence entries missing a resource, this comes in when a new friend is added but will never get updated when user logs off if (UserJid.IsValid() && !UserJid.Resource.IsEmpty()) { FScopeLock Lock(&RosterLock); FXmppUserPresenceJingle& RosterEntry = RosterPresence.FindOrAdd(UserJid.GetFullPath()); ConvertToPresence(*RosterEntry.Presence, InStatus, UserJid); FXmppJingle::ConvertToJid(RosterEntry.UserJid, InStatus.jid()); UE_LOG(LogXmpp, Verbose, TEXT("Received presence for user [%s]"), *UserJid.GetFullPath()); DebugPrintPresence(*RosterEntry.Presence); RosterUpdates.Enqueue(UserJid.GetFullPath()); } else if (UserJid.IsValid() && UserJid.Resource.IsEmpty()) { UE_LOG(LogXmpp, Warning, TEXT("Ignoring presence update with empty resource. StatusJid = %s, JidFullPath = %s"), UTF8_TO_TCHAR(InStatus.jid().Str().c_str()), *UserJid.GetFullPath()); } } }
bool FXmppPresenceJingle::UpdatePresence(const FXmppUserPresence& InPresence) { bool bResult = false; CachedPresence = InPresence; if (PresenceSendTask != NULL) { CachedPresence.SentTime = FDateTime::UtcNow(); ConvertFromPresence(CachedStatus, CachedPresence); UE_LOG(LogXmpp, Verbose, TEXT("Sending presence update for user [%s]"), UTF8_TO_TCHAR(CachedStatus.jid().node().c_str())); DebugPrintPresence(CachedPresence); bResult = PresenceUpdateRequests.Enqueue(new buzz::PresenceStatus(CachedStatus)); NumPresenceOut++; } return bResult; }