pidgin.next.minor: 6b848e03: As discussed on the devel list, purple_s...
evands at pidgin.im
evands at pidgin.im
Wed Apr 30 02:30:44 EDT 2008
-----------------------------------------------------------------
Revision: 6b848e03c7f6c7c392579517011deded648dedec
Ancestor: 4c808c0b86c835fc9498dcc837db94e4930f73ce
Author: evands at pidgin.im
Date: 2008-04-30T06:29:16
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/6b848e03c7f6c7c392579517011deded648dedec
Modified files:
doc/conversation-signals.dox libpurple/conversation.c
libpurple/protocols/jabber/chat.c
libpurple/protocols/jabber/chat.h
libpurple/protocols/jabber/presence.c libpurple/server.c
libpurple/server.h
ChangeLog:
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.
-------------- next part --------------
============================================================
--- doc/conversation-signals.dox d8f88bde44a965deb9552b89749dacaefe2b3992
+++ doc/conversation-signals.dox e32f1ee5cde569a10aa31021f7b02012a37279f0
@@ -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 @@ void (*chat_buddy_joined)(PurpleConversa
@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,
============================================================
--- libpurple/conversation.c 933fb27de584a3aee0c80c0a9b68d9e0c2e5fbbf
+++ libpurple/conversation.c 3ee63b27f8f6cf4fe9f6259f5420b9e13f3f1f10
@@ -2372,7 +2372,7 @@ purple_conversations_init(void)
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,
============================================================
--- libpurple/protocols/jabber/chat.c 0aadd2a92f2f7471d50b36a3165971c86b044b63
+++ libpurple/protocols/jabber/chat.c 5ff5bdb5292802f09d911922a60617e3670f3f84
@@ -222,39 +222,36 @@ void jabber_chat_join(PurpleConnection *
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 @@ void jabber_chat_join(PurpleConnection *
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 @@ void jabber_chat_free(JabberChat *chat)
g_free(chat->server);
g_free(chat->handle);
g_hash_table_destroy(chat->members);
+ g_hash_table_unref(chat->components);
g_free(chat);
}
============================================================
--- libpurple/protocols/jabber/chat.h c586a97d46b8888db724d4b1529a6b39b442063e
+++ libpurple/protocols/jabber/chat.h 67931fd52732b837f63ee3ff76a088c624bd3127
@@ -41,6 +41,7 @@ typedef struct _JabberChat {
char *room;
char *server;
char *handle;
+ GHashTable *components;
int id;
PurpleConversation *conv;
gboolean muc;
============================================================
--- libpurple/protocols/jabber/presence.c d639eb9e743b7e4249320d7fd99a6bd70dfc06a7
+++ libpurple/protocols/jabber/presence.c e9cd5c584fe9108ac7d0ff70b083c6ca5634aa26
@@ -587,7 +587,7 @@ void jabber_presence_parse(JabberStream
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);
============================================================
--- libpurple/server.c cfad78cf203a79f1a25987a813c811ebd198c2db
+++ libpurple/server.c 56330bd5cbd656d20cb6baec93c8dc120bb012d1
@@ -967,10 +967,10 @@ void serv_got_chat_left(PurpleConnection
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,
============================================================
--- libpurple/server.h 4928a407fd71581673c26469eb9ef0f71ae9c546
+++ libpurple/server.h 2d4f6944539b1304ae6435e480f1a460ca986f25
@@ -171,9 +171,11 @@ PurpleConversation *serv_got_joined_chat
* 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,
More information about the Commits
mailing list