# HG changeset patch # User Evan Schoenberg # Date 1209536956 0 # Node ID 591ef3693345fce12770c0b957d77ddd4028c7c6 # Parent f3dc7ef7385bd5f9831773ad8795b36376650a22 As discussed on the devel list, purple_serv_got_join_chat_failed() and the "chat-join-failed" signal now accept and pass (respectively) a GHashTable instead of a string. The GHashTable is the same one which was passed to serv_join_chat() originally. diff -r f3dc7ef7385b -r 591ef3693345 doc/conversation-signals.dox --- a/doc/conversation-signals.dox Wed Apr 30 05:56:53 2008 +0000 +++ b/doc/conversation-signals.dox Wed Apr 30 06:29:16 2008 +0000 @@ -27,6 +27,7 @@ @signal chat-invited-user @signal chat-invited @signal chat-joined + @signal chat-join-failed @signal chat-left @signal chat-topic-changed @signal conversation-extended-menu @@ -302,6 +303,18 @@ @param new_arrival If the buddy is a new arrival. @endsignaldef + @signaldef chat-join-failed + @signalproto +void (*chat_join_failed)(PurpleConnection *gc, GHashTable *components); + @endsignalproto + @signaldesc + Emitted when an account fails to join a chat room + @param gc The PurpleConnection of the account which failed to join the chat. + @param data The components passed to serv_join_chat() originally. + The hash function should be g_str_hash() and the equal + function should be g_str_equal(). + @endsignaldef + @signaldef chat-buddy-flags @signalproto void (*chat_buddy_flags)(PurpleConversation *conv, const char *name, diff -r f3dc7ef7385b -r 591ef3693345 libpurple/conversation.c --- a/libpurple/conversation.c Wed Apr 30 05:56:53 2008 +0000 +++ b/libpurple/conversation.c Wed Apr 30 06:29:16 2008 +0000 @@ -2372,7 +2372,7 @@ purple_marshal_VOID__POINTER_POINTER, NULL, 2, purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new(PURPLE_TYPE_STRING)); + purple_value_new(PURPLE_TYPE_POINTER)); purple_signal_register(handle, "chat-left", purple_marshal_VOID__POINTER, NULL, 1, diff -r f3dc7ef7385b -r 591ef3693345 libpurple/protocols/jabber/chat.c --- a/libpurple/protocols/jabber/chat.c Wed Apr 30 05:56:53 2008 +0000 +++ b/libpurple/protocols/jabber/chat.c Wed Apr 30 06:29:16 2008 +0000 @@ -222,39 +222,36 @@ if(!handle) handle = js->user->node; - tmp = g_strdup_printf("%s@%s", room, server); - room_jid = g_strdup(jabber_normalize(NULL, tmp)); - g_free(tmp); - if(!jabber_nodeprep_validate(room)) { char *buf = g_strdup_printf(_("%s is not a valid room name"), room); purple_notify_error(gc, _("Invalid Room Name"), _("Invalid Room Name"), buf); - purple_serv_got_join_chat_failed(gc, room_jid); - g_free(room_jid); + purple_serv_got_join_chat_failed(gc, data); g_free(buf); return; } else if(!jabber_nameprep_validate(server)) { char *buf = g_strdup_printf(_("%s is not a valid server name"), server); purple_notify_error(gc, _("Invalid Server Name"), _("Invalid Server Name"), buf); - purple_serv_got_join_chat_failed(gc, room_jid); - g_free(room_jid); + purple_serv_got_join_chat_failed(gc, data); g_free(buf); return; } else if(!jabber_resourceprep_validate(handle)) { char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle); purple_notify_error(gc, _("Invalid Room Handle"), _("Invalid Room Handle"), buf); - purple_serv_got_join_chat_failed(gc, room_jid); + purple_serv_got_join_chat_failed(gc, data); g_free(buf); - g_free(room_jid); return; } if(jabber_chat_find(js, room, server)) return; + tmp = g_strdup_printf("%s@%s", room, server); + room_jid = g_strdup(jabber_normalize(NULL, tmp)); + g_free(tmp); + chat = g_new0(JabberChat, 1); chat->js = gc->proto_data; @@ -262,6 +259,8 @@ chat->server = g_strdup(server); chat->handle = g_strdup(handle); + chat->components = g_hash_table_ref(data); + chat->members = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)jabber_chat_member_free); @@ -322,6 +321,7 @@ g_free(chat->server); g_free(chat->handle); g_hash_table_destroy(chat->members); + g_hash_table_unref(chat->components); g_free(chat); } diff -r f3dc7ef7385b -r 591ef3693345 libpurple/protocols/jabber/chat.h --- a/libpurple/protocols/jabber/chat.h Wed Apr 30 05:56:53 2008 +0000 +++ b/libpurple/protocols/jabber/chat.h Wed Apr 30 06:29:16 2008 +0000 @@ -41,6 +41,7 @@ char *room; char *server; char *handle; + GHashTable *components; int id; PurpleConversation *conv; gboolean muc; diff -r f3dc7ef7385b -r 591ef3693345 libpurple/protocols/jabber/presence.c --- a/libpurple/protocols/jabber/presence.c Wed Apr 30 05:56:53 2008 +0000 +++ b/libpurple/protocols/jabber/presence.c Wed Apr 30 06:29:16 2008 +0000 @@ -587,7 +587,7 @@ serv_got_chat_left(js->gc, chat->id); } else { title = g_strdup_printf(_("Error joining chat %s"), from); - purple_serv_got_join_chat_failed(js->gc, room_jid); + purple_serv_got_join_chat_failed(js->gc, chat->components); } purple_notify_error(js->gc, title, title, msg); g_free(title); diff -r f3dc7ef7385b -r 591ef3693345 libpurple/server.c --- a/libpurple/server.c Wed Apr 30 05:56:53 2008 +0000 +++ b/libpurple/server.c Wed Apr 30 06:29:16 2008 +0000 @@ -967,10 +967,10 @@ purple_signal_emit(purple_conversations_get_handle(), "chat-left", conv); } -void purple_serv_got_join_chat_failed(PurpleConnection *gc, const char *name) +void purple_serv_got_join_chat_failed(PurpleConnection *gc, GHashTable *data) { purple_signal_emit(purple_conversations_get_handle(), "chat-join-failed", - gc, name); + gc, data); } void serv_got_chat_in(PurpleConnection *g, int id, const char *who, diff -r f3dc7ef7385b -r 591ef3693345 libpurple/server.h --- a/libpurple/server.h Wed Apr 30 05:56:53 2008 +0000 +++ b/libpurple/server.h Wed Apr 30 06:29:16 2008 +0000 @@ -171,9 +171,11 @@ * fails. * * @param gc The connection on which chat joining failed - * @param name The name of the chat which we did not join + * @param data The components passed to serv_join_chat() originally. + * The hash function should be g_str_hash() and the equal + * function should be g_str_equal(). */ -void purple_serv_got_join_chat_failed(PurpleConnection *gc, const char *name); +void purple_serv_got_join_chat_failed(PurpleConnection *gc, GHashTable *data); void serv_got_chat_left(PurpleConnection *g, int id); void serv_got_chat_in(PurpleConnection *g, int id, const char *who,