libpurple/protocols/gg/chat.c

changeset 40697
81f81f5d2f39
parent 40541
9ceb8d25d4d9
child 40885
87f6241da196
equal deleted inserted replaced
40696:cf58ec89b1e4 40697:81f81f5d2f39
291 chat->left = TRUE; 291 chat->left = TRUE;
292 } 292 }
293 purple_chat_conversation_remove_user(chat->conv, ggp_uin_to_str(uin), NULL); 293 purple_chat_conversation_remove_user(chat->conv, ggp_uin_to_str(uin), NULL);
294 } 294 }
295 295
296 GList * ggp_chat_info(PurpleConnection *gc) 296 GList *
297 { 297 ggp_chat_info(PurpleProtocolChat *protocol_chat, PurpleConnection *gc) {
298 GList *m = NULL; 298 GList *m = NULL;
299 PurpleProtocolChatEntry *pce; 299 PurpleProtocolChatEntry *pce;
300 300
301 pce = g_new0(PurpleProtocolChatEntry, 1); 301 pce = g_new0(PurpleProtocolChatEntry, 1);
302 pce->label = _("_Conference identifier:"); 302 pce->label = _("_Conference identifier:");
305 m = g_list_append(m, pce); 305 m = g_list_append(m, pce);
306 306
307 return m; 307 return m;
308 } 308 }
309 309
310 GHashTable * ggp_chat_info_defaults(PurpleConnection *gc, const char *chat_name) 310 GHashTable *
311 ggp_chat_info_defaults(PurpleProtocolChat *protocol_chat, PurpleConnection *gc,
312 const gchar *chat_name)
311 { 313 {
312 GHashTable *defaults; 314 GHashTable *defaults;
313 315
314 defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); 316 defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
315 317
317 g_hash_table_insert(defaults, "id", g_strdup(chat_name)); 319 g_hash_table_insert(defaults, "id", g_strdup(chat_name));
318 320
319 return defaults; 321 return defaults;
320 } 322 }
321 323
322 char * ggp_chat_get_name(GHashTable *components) 324 gchar *
323 { 325 ggp_chat_get_name(PurpleProtocolChat *protocol_chat, GHashTable *components) {
324 return g_strdup((gchar*)g_hash_table_lookup(components, "id")); 326 return g_strdup((gchar*)g_hash_table_lookup(components, "id"));
325 } 327 }
326 328
327 static const gchar * ggp_chat_get_name_from_id(uint64_t id) 329 static const gchar * ggp_chat_get_name_from_id(uint64_t id)
328 { 330 {
345 return 0; 347 return 0;
346 348
347 return id; 349 return id;
348 } 350 }
349 351
350 void ggp_chat_join(PurpleConnection *gc, GHashTable *components) 352 void
353 ggp_chat_join(PurpleProtocolChat *protocol_chat, PurpleConnection *gc,
354 GHashTable *components)
351 { 355 {
352 ggp_chat_session_data *sdata = ggp_chat_get_sdata(gc); 356 ggp_chat_session_data *sdata = ggp_chat_get_sdata(gc);
353 GGPInfo *info = purple_connection_get_protocol_data(gc); 357 GGPInfo *info = purple_connection_get_protocol_data(gc);
354 const gchar *id_cs; 358 const gchar *id_cs;
355 gchar *id_s; 359 gchar *id_s;
392 } 396 }
393 397
394 static void ggp_chat_join_id(PurpleConnection *gc, uint64_t id) 398 static void ggp_chat_join_id(PurpleConnection *gc, uint64_t id)
395 { 399 {
396 GHashTable *components; 400 GHashTable *components;
401 PurpleProtocol *protocol = purple_connection_get_protocol(gc);
402
397 ggp_chat_local_info *chat = ggp_chat_get(gc, id); 403 ggp_chat_local_info *chat = ggp_chat_get(gc, id);
398 404
399 if (chat && !chat->left) { 405 if (chat && !chat->left) {
400 ggp_chat_open_conv(chat); 406 ggp_chat_open_conv(chat);
401 return; 407 return;
414 _("Could not join chat room"), 420 _("Could not join chat room"),
415 _("You have to ask for invitation from another chat " 421 _("You have to ask for invitation from another chat "
416 "participant"), NULL); 422 "participant"), NULL);
417 } 423 }
418 424
419 components = ggp_chat_info_defaults(gc, ggp_chat_get_name_from_id(id)); 425 components = ggp_chat_info_defaults(PURPLE_PROTOCOL_CHAT(protocol), gc,
426 ggp_chat_get_name_from_id(id));
420 purple_serv_got_join_chat_failed(gc, components); 427 purple_serv_got_join_chat_failed(gc, components);
421 g_hash_table_destroy(components); 428 g_hash_table_destroy(components);
422 } 429 }
423 430
424 void ggp_chat_leave(PurpleConnection *gc, int local_id) 431 void
432 ggp_chat_leave(PurpleProtocolChat *protocol_chat, PurpleConnection *gc,
433 gint local_id)
425 { 434 {
426 GGPInfo *info = purple_connection_get_protocol_data(gc); 435 GGPInfo *info = purple_connection_get_protocol_data(gc);
427 ggp_chat_local_info *chat; 436 ggp_chat_local_info *chat;
428 uin_t me; 437 uin_t me;
429 438
446 455
447 ggp_chat_left(chat, me); 456 ggp_chat_left(chat, me);
448 chat->left = TRUE; 457 chat->left = TRUE;
449 } 458 }
450 459
451 void ggp_chat_invite(PurpleConnection *gc, int local_id, const char *message, 460 void
452 const char *who) 461 ggp_chat_invite(PurpleProtocolChat *protocol_chat, PurpleConnection *gc,
462 gint local_id, const gchar *message, const gchar *who)
453 { 463 {
454 GGPInfo *info = purple_connection_get_protocol_data(gc); 464 GGPInfo *info = purple_connection_get_protocol_data(gc);
455 ggp_chat_local_info *chat; 465 ggp_chat_local_info *chat;
456 uin_t invited; 466 uin_t invited;
457 467
468 "unable to invite %s to chat %" G_GUINT64_FORMAT "\n", 478 "unable to invite %s to chat %" G_GUINT64_FORMAT "\n",
469 who, chat->id); 479 who, chat->id);
470 } 480 }
471 } 481 }
472 482
473 int ggp_chat_send(PurpleConnection *gc, int local_id, PurpleMessage *msg) 483 gint
484 ggp_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc,
485 gint local_id, PurpleMessage *msg)
474 { 486 {
475 GGPInfo *info = purple_connection_get_protocol_data(gc); 487 GGPInfo *info = purple_connection_get_protocol_data(gc);
476 GDateTime *dt = NULL; 488 GDateTime *dt = NULL;
477 PurpleChatConversation *conv; 489 PurpleChatConversation *conv;
478 ggp_chat_local_info *chat; 490 ggp_chat_local_info *chat;

mercurial