return TRUE;
}
+static void dialog_response_callback(GtkDialog *dialog, gint response_id,
+ gpointer user_data)
+{
+ void (^block)(gint) = user_data;
+ block(response_id);
+ [block release];
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+}
+
@implementation JubGtkRosterUI
- initWithClient: (JubChatClient*)client
{
withObject: group];
}
+- (void)contactManager: (XMPPContactManager*)manager
+ didReceiveSubscriptionRequest: (XMPPPresence*)presence
+{
+ XMPPJID *JID = presence.from;
+ OFString *message = [OFString stringWithFormat: @"<b>%@</b> would like "
+ @"to subscribe to your presence.", JID];
+ of_log(@"%@", message);
+ g_idle_add_block(^{
+ GtkWidget *dialog, *content_area, *label;
+ dialog = gtk_dialog_new_with_buttons("Subscription Request",
+ GTK_WINDOW(_roster_window), GTK_DIALOG_DESTROY_WITH_PARENT,
+ "Accept", GTK_RESPONSE_ACCEPT,
+ "Deny", GTK_RESPONSE_REJECT, NULL);
+
+ content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+ label = gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), [message UTF8String]);
+
+ g_signal_connect(dialog, "response",
+ G_CALLBACK(dialog_response_callback),
+ [^(gint response_id) {
+ if (response_id == GTK_RESPONSE_ACCEPT)
+ [manager sendSubscribedToJID: JID];
+ else if (response_id == GTK_RESPONSE_REJECT)
+ [manager sendUnsubscribedToJID: JID];
+ } copy]);
+
+ gtk_container_add(GTK_CONTAINER(content_area), label);
+ gtk_widget_show_all(dialog);
+ });
+}
+
- (void)contact: (XMPPContact*)contact
willUpdateWithRosterItem: (XMPPRosterItem*)rosterItem;
{