comparison libpurple/protocols/jabber/chat.c @ 23103:591ef3693345

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.
author Evan Schoenberg <evan.s@dreskin.net>
date Wed, 30 Apr 2008 06:29:16 +0000
parents 43233dc1d40b
children 568a0957e835
comparison
equal deleted inserted replaced
23102:f3dc7ef7385b 23103:591ef3693345
220 return; 220 return;
221 221
222 if(!handle) 222 if(!handle)
223 handle = js->user->node; 223 handle = js->user->node;
224 224
225 tmp = g_strdup_printf("%s@%s", room, server);
226 room_jid = g_strdup(jabber_normalize(NULL, tmp));
227 g_free(tmp);
228
229 if(!jabber_nodeprep_validate(room)) { 225 if(!jabber_nodeprep_validate(room)) {
230 char *buf = g_strdup_printf(_("%s is not a valid room name"), room); 226 char *buf = g_strdup_printf(_("%s is not a valid room name"), room);
231 purple_notify_error(gc, _("Invalid Room Name"), _("Invalid Room Name"), 227 purple_notify_error(gc, _("Invalid Room Name"), _("Invalid Room Name"),
232 buf); 228 buf);
233 purple_serv_got_join_chat_failed(gc, room_jid); 229 purple_serv_got_join_chat_failed(gc, data);
234 g_free(room_jid);
235 g_free(buf); 230 g_free(buf);
236 return; 231 return;
237 } else if(!jabber_nameprep_validate(server)) { 232 } else if(!jabber_nameprep_validate(server)) {
238 char *buf = g_strdup_printf(_("%s is not a valid server name"), server); 233 char *buf = g_strdup_printf(_("%s is not a valid server name"), server);
239 purple_notify_error(gc, _("Invalid Server Name"), 234 purple_notify_error(gc, _("Invalid Server Name"),
240 _("Invalid Server Name"), buf); 235 _("Invalid Server Name"), buf);
241 purple_serv_got_join_chat_failed(gc, room_jid); 236 purple_serv_got_join_chat_failed(gc, data);
242 g_free(room_jid);
243 g_free(buf); 237 g_free(buf);
244 return; 238 return;
245 } else if(!jabber_resourceprep_validate(handle)) { 239 } else if(!jabber_resourceprep_validate(handle)) {
246 char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle); 240 char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle);
247 purple_notify_error(gc, _("Invalid Room Handle"), 241 purple_notify_error(gc, _("Invalid Room Handle"),
248 _("Invalid Room Handle"), buf); 242 _("Invalid Room Handle"), buf);
249 purple_serv_got_join_chat_failed(gc, room_jid); 243 purple_serv_got_join_chat_failed(gc, data);
250 g_free(buf); 244 g_free(buf);
251 g_free(room_jid);
252 return; 245 return;
253 } 246 }
254 247
255 if(jabber_chat_find(js, room, server)) 248 if(jabber_chat_find(js, room, server))
256 return; 249 return;
250
251 tmp = g_strdup_printf("%s@%s", room, server);
252 room_jid = g_strdup(jabber_normalize(NULL, tmp));
253 g_free(tmp);
257 254
258 chat = g_new0(JabberChat, 1); 255 chat = g_new0(JabberChat, 1);
259 chat->js = gc->proto_data; 256 chat->js = gc->proto_data;
260 257
261 chat->room = g_strdup(room); 258 chat->room = g_strdup(room);
262 chat->server = g_strdup(server); 259 chat->server = g_strdup(server);
263 chat->handle = g_strdup(handle); 260 chat->handle = g_strdup(handle);
264 261
262 chat->components = g_hash_table_ref(data);
263
265 chat->members = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, 264 chat->members = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
266 (GDestroyNotify)jabber_chat_member_free); 265 (GDestroyNotify)jabber_chat_member_free);
267 266
268 g_hash_table_insert(js->chats, room_jid, chat); 267 g_hash_table_insert(js->chats, room_jid, chat);
269 268
320 319
321 g_free(chat->room); 320 g_free(chat->room);
322 g_free(chat->server); 321 g_free(chat->server);
323 g_free(chat->handle); 322 g_free(chat->handle);
324 g_hash_table_destroy(chat->members); 323 g_hash_table_destroy(chat->members);
324 g_hash_table_unref(chat->components);
325 g_free(chat); 325 g_free(chat);
326 } 326 }
327 327
328 gboolean jabber_chat_find_buddy(PurpleConversation *conv, const char *name) 328 gboolean jabber_chat_find_buddy(PurpleConversation *conv, const char *name)
329 { 329 {