]> cgit.babelmonkeys.de Git - jubjub.git/blobdiff - src/core/JubChatClient.m
Move presence changing to JubChatClient
[jubjub.git] / src / core / JubChatClient.m
index b46c14cf8fa3def40723d60a671770961a1e437f..eea1b8a98fd0af6df0e898a3e951c850cd102d8a 100644 (file)
        return chat;
 }
 
+- (void)sendPresenceWithStatus: (OFString*)status
+{
+       [self sendPresenceWithStatus: status
+                               text: nil];
+}
+
+- (void)sendPresenceWithStatus: (OFString*)status
+                         text: (OFString*)text
+{
+       XMPPPresence *presence;
+
+       if ([status isEqual: @"unavailable"])
+               presence = [XMPPPresence presenceWithType: @"unavailable"];
+       else
+               presence = [XMPPPresence presence];
+
+       if (!([status isEqual: @"available"] ||
+             [status isEqual: @"unavailable"]))
+               presence.show = status;
+
+       if (text != nil)
+               presence.status = text;
+
+       [_connection sendStanza: presence];
+}
+
 - (void)connection: (XMPPConnection*)connection
      wasBoundToJID: (XMPPJID*)jid
 {