static void presence_changed(GtkComboBox *combo_box, gpointer data)
{
- XMPPPresence *pres;
- XMPPConnection *connection = data;
+ JubChatClient *client = data;
OFAutoreleasePool *pool = [OFAutoreleasePool new];
-
const char *status = gtk_combo_box_get_active_id(combo_box);
- if (!strcmp(status, "unavailable"))
- pres = [XMPPPresence presenceWithType: @"unavailable"];
- else {
- pres = [XMPPPresence presence];
- if (strcmp(status, "available"))
- [pres setShow: @(status)];
- }
-
- [connection sendStanza: pres];
+ [client sendPresenceWithStatus: @(status)];
[pool release];
}
_presence_combo_changed_handler_id =
g_signal_connect(_presence_combo, "changed",
- G_CALLBACK(presence_changed), client.connection);
+ G_CALLBACK(presence_changed), client);
g_object_unref(G_OBJECT(builder));
} @catch (id e) {
[super dealloc];
}
-- (void)contact: (XMPPContact*)contact
- didSendMessage: (XMPPMessage*)message
-{
- if (message.body == nil || ![message.type isEqual: @"chat"])
- return;
-
- id<JubChatUI> chat = [_client chatForContact: contact];
- [chat addMessage: message.body
- sender: [message.from bareJID]];
-}
-
/* Roster Delegate methods */
- (void)Jub_addRosterItem: (XMPPRosterItem*)item
group: (OFString*)group
[OFMutableString stringWithString: @"<b>Resources:</b>"];
[allPresences enumerateKeysAndObjectsUsingBlock:
- ^(OFString *resource, XMPPPresence *pres, BOOL *stop) {
+ ^(OFString *resource, XMPPPresence *pres, bool *stop) {
[tooltip appendString: @"\n"];
[tooltip appendString: resource];
if ([pres.type isEqual: @"available"]) {