+- (void)client: (JubChatClient*)client
+ didChangePresence: (XMPPPresence*)presence
+{
+ OFString *tooltip = @"";
+ OFString *show =
+ [[presence elementForName: @"show"
+ namespace: XMPP_NS_CLIENT] stringValue];
+ OFString *status =
+ [[presence elementForName: @"status"
+ namespace: XMPP_NS_CLIENT] stringValue];
+
+ if (status != nil)
+ tooltip = [@"<b>Status:</b> " stringByAppendingString: status];
+
+ // FIXME: Changing the active id will send another presence
+ g_idle_add_block(^{
+ if ([presence.type isEqual: @"unavailable"])
+ gtk_combo_box_set_active_id(presence_combo,
+ "unavailable");
+ else if (show == nil)
+ gtk_combo_box_set_active_id(presence_combo,
+ "available");
+ else
+ gtk_combo_box_set_active_id(presence_combo,
+ [show UTF8String]);
+
+
+ gtk_widget_set_tooltip_markup(GTK_WIDGET(presence_combo),
+ [tooltip UTF8String]);
+ });
+}