Mercurial > pidgin
comparison libpurple/protocols/silc/chat.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
| author | Elliott Sales de Andrade <qulogic@pidgin.im> |
|---|---|
| date | Sat, 02 Jun 2012 02:30:49 +0000 |
| parents | 3899615cef8a |
| children |
comparison
equal
deleted
inserted
replaced
| 32818:01ff09d4a463 | 32819:2c6510167895 |
|---|---|
| 89 | 89 |
| 90 | 90 |
| 91 static void | 91 static void |
| 92 silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components) | 92 silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components) |
| 93 { | 93 { |
| 94 SilcPurple sg = gc->proto_data; | 94 SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 95 const char *chname; | 95 const char *chname; |
| 96 char tmp[256], *tmp2; | 96 char tmp[256], *tmp2; |
| 97 GString *s; | 97 GString *s; |
| 98 SilcChannelEntry channel; | 98 SilcChannelEntry channel; |
| 99 SilcHashTableList htl; | 99 SilcHashTableList htl; |
| 498 | 498 |
| 499 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); | 499 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
| 500 | 500 |
| 501 chat = (PurpleChat *) node; | 501 chat = (PurpleChat *) node; |
| 502 gc = purple_account_get_connection(purple_chat_get_account(chat)); | 502 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
| 503 sg = gc->proto_data; | 503 sg = purple_connection_get_protocol_data(gc); |
| 504 | 504 |
| 505 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", | 505 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
| 506 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), | 506 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 507 "+C", NULL); | 507 "+C", NULL); |
| 508 } | 508 } |
| 585 | 585 |
| 586 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); | 586 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
| 587 | 587 |
| 588 chat = (PurpleChat *) node; | 588 chat = (PurpleChat *) node; |
| 589 gc = purple_account_get_connection(purple_chat_get_account(chat)); | 589 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
| 590 sg = gc->proto_data; | 590 sg = purple_connection_get_protocol_data(gc); |
| 591 | 591 |
| 592 p = silc_calloc(1, sizeof(*p)); | 592 p = silc_calloc(1, sizeof(*p)); |
| 593 if (!p) | 593 if (!p) |
| 594 return; | 594 return; |
| 595 p->sg = sg; | 595 p->sg = sg; |
| 635 | 635 |
| 636 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); | 636 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
| 637 | 637 |
| 638 chat = (PurpleChat *) node; | 638 chat = (PurpleChat *) node; |
| 639 gc = purple_account_get_connection(purple_chat_get_account(chat)); | 639 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
| 640 sg = gc->proto_data; | 640 sg = purple_connection_get_protocol_data(gc); |
| 641 | 641 |
| 642 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", | 642 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
| 643 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), | 643 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 644 "-f", NULL); | 644 "-f", NULL); |
| 645 } | 645 } |
| 654 | 654 |
| 655 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); | 655 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
| 656 | 656 |
| 657 chat = (PurpleChat *) node; | 657 chat = (PurpleChat *) node; |
| 658 gc = purple_account_get_connection(purple_chat_get_account(chat)); | 658 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
| 659 sg = gc->proto_data; | 659 sg = purple_connection_get_protocol_data(gc); |
| 660 | 660 |
| 661 if (!sg->conn) | 661 if (!sg->conn) |
| 662 return; | 662 return; |
| 663 | 663 |
| 664 /* XXX we should have ability to define which founder | 664 /* XXX we should have ability to define which founder |
| 731 | 731 |
| 732 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); | 732 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
| 733 | 733 |
| 734 chat = (PurpleChat *) node; | 734 chat = (PurpleChat *) node; |
| 735 gc = purple_account_get_connection(purple_chat_get_account(chat)); | 735 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
| 736 sg = gc->proto_data; | 736 sg = purple_connection_get_protocol_data(gc); |
| 737 | 737 |
| 738 if (!sg->conn) | 738 if (!sg->conn) |
| 739 return; | 739 return; |
| 740 | 740 |
| 741 ch = g_strdup(g_hash_table_lookup(purple_chat_get_components(chat), "channel")); | 741 ch = g_strdup(g_hash_table_lookup(purple_chat_get_components(chat), "channel")); |
| 766 | 766 |
| 767 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); | 767 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
| 768 | 768 |
| 769 chat = (PurpleChat *) node; | 769 chat = (PurpleChat *) node; |
| 770 gc = purple_account_get_connection(purple_chat_get_account(chat)); | 770 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
| 771 sg = gc->proto_data; | 771 sg = purple_connection_get_protocol_data(gc); |
| 772 | 772 |
| 773 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", | 773 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
| 774 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), | 774 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 775 "-t", NULL); | 775 "-t", NULL); |
| 776 } | 776 } |
| 784 | 784 |
| 785 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); | 785 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
| 786 | 786 |
| 787 chat = (PurpleChat *) node; | 787 chat = (PurpleChat *) node; |
| 788 gc = purple_account_get_connection(purple_chat_get_account(chat)); | 788 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
| 789 sg = gc->proto_data; | 789 sg = purple_connection_get_protocol_data(gc); |
| 790 | 790 |
| 791 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", | 791 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
| 792 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), | 792 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 793 "+t", NULL); | 793 "+t", NULL); |
| 794 } | 794 } |
| 802 | 802 |
| 803 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); | 803 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
| 804 | 804 |
| 805 chat = (PurpleChat *) node; | 805 chat = (PurpleChat *) node; |
| 806 gc = purple_account_get_connection(purple_chat_get_account(chat)); | 806 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
| 807 sg = gc->proto_data; | 807 sg = purple_connection_get_protocol_data(gc); |
| 808 | 808 |
| 809 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", | 809 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
| 810 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), | 810 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 811 "-p", NULL); | 811 "-p", NULL); |
| 812 } | 812 } |
| 820 | 820 |
| 821 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); | 821 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
| 822 | 822 |
| 823 chat = (PurpleChat *) node; | 823 chat = (PurpleChat *) node; |
| 824 gc = purple_account_get_connection(purple_chat_get_account(chat)); | 824 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
| 825 sg = gc->proto_data; | 825 sg = purple_connection_get_protocol_data(gc); |
| 826 | 826 |
| 827 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", | 827 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
| 828 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), | 828 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 829 "+p", NULL); | 829 "+p", NULL); |
| 830 } | 830 } |
| 838 | 838 |
| 839 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); | 839 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
| 840 | 840 |
| 841 chat = (PurpleChat *) node; | 841 chat = (PurpleChat *) node; |
| 842 gc = purple_account_get_connection(purple_chat_get_account(chat)); | 842 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
| 843 sg = gc->proto_data; | 843 sg = purple_connection_get_protocol_data(gc); |
| 844 | 844 |
| 845 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", | 845 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
| 846 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), | 846 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 847 "-s", NULL); | 847 "-s", NULL); |
| 848 } | 848 } |
| 856 | 856 |
| 857 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); | 857 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
| 858 | 858 |
| 859 chat = (PurpleChat *) node; | 859 chat = (PurpleChat *) node; |
| 860 gc = purple_account_get_connection(purple_chat_get_account(chat)); | 860 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
| 861 sg = gc->proto_data; | 861 sg = purple_connection_get_protocol_data(gc); |
| 862 | 862 |
| 863 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", | 863 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
| 864 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), | 864 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 865 "+s", NULL); | 865 "+s", NULL); |
| 866 } | 866 } |
| 880 | 880 |
| 881 GList *silcpurple_chat_menu(PurpleChat *chat) | 881 GList *silcpurple_chat_menu(PurpleChat *chat) |
| 882 { | 882 { |
| 883 GHashTable *components = purple_chat_get_components(chat); | 883 GHashTable *components = purple_chat_get_components(chat); |
| 884 PurpleConnection *gc = purple_account_get_connection(purple_chat_get_account(chat)); | 884 PurpleConnection *gc = purple_account_get_connection(purple_chat_get_account(chat)); |
| 885 SilcPurple sg = gc->proto_data; | 885 SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 886 SilcClientConnection conn = sg->conn; | 886 SilcClientConnection conn = sg->conn; |
| 887 const char *chname = NULL; | 887 const char *chname = NULL; |
| 888 SilcChannelEntry channel = NULL; | 888 SilcChannelEntry channel = NULL; |
| 889 SilcChannelUser chu = NULL; | 889 SilcChannelUser chu = NULL; |
| 890 SilcUInt32 mode = 0; | 890 SilcUInt32 mode = 0; |
| 1018 return g_strdup(g_hash_table_lookup(data, "channel")); | 1018 return g_strdup(g_hash_table_lookup(data, "channel")); |
| 1019 } | 1019 } |
| 1020 | 1020 |
| 1021 void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data) | 1021 void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data) |
| 1022 { | 1022 { |
| 1023 SilcPurple sg = gc->proto_data; | 1023 SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 1024 SilcClient client = sg->client; | 1024 SilcClient client = sg->client; |
| 1025 SilcClientConnection conn = sg->conn; | 1025 SilcClientConnection conn = sg->conn; |
| 1026 const char *channel, *passphrase, *parentch; | 1026 const char *channel, *passphrase, *parentch; |
| 1027 | 1027 |
| 1028 if (!conn) | 1028 if (!conn) |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, | 1103 void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, |
| 1104 const char *name) | 1104 const char *name) |
| 1105 { | 1105 { |
| 1106 SilcPurple sg = gc->proto_data; | 1106 SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 1107 SilcClient client = sg->client; | 1107 SilcClient client = sg->client; |
| 1108 SilcClientConnection conn = sg->conn; | 1108 SilcClientConnection conn = sg->conn; |
| 1109 SilcHashTableList htl; | 1109 SilcHashTableList htl; |
| 1110 SilcChannelUser chu; | 1110 SilcChannelUser chu; |
| 1111 gboolean found = FALSE; | 1111 gboolean found = FALSE; |
| 1146 name, NULL); | 1146 name, NULL); |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 void silcpurple_chat_leave(PurpleConnection *gc, int id) | 1149 void silcpurple_chat_leave(PurpleConnection *gc, int id) |
| 1150 { | 1150 { |
| 1151 SilcPurple sg = gc->proto_data; | 1151 SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 1152 SilcClient client = sg->client; | 1152 SilcClient client = sg->client; |
| 1153 SilcClientConnection conn = sg->conn; | 1153 SilcClientConnection conn = sg->conn; |
| 1154 SilcHashTableList htl; | 1154 SilcHashTableList htl; |
| 1155 SilcChannelUser chu; | 1155 SilcChannelUser chu; |
| 1156 gboolean found = FALSE; | 1156 gboolean found = FALSE; |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, | 1218 int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, |
| 1219 PurpleMessageFlags msgflags) | 1219 PurpleMessageFlags msgflags) |
| 1220 { | 1220 { |
| 1221 SilcPurple sg = gc->proto_data; | 1221 SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 1222 SilcClient client = sg->client; | 1222 SilcClient client = sg->client; |
| 1223 SilcClientConnection conn = sg->conn; | 1223 SilcClientConnection conn = sg->conn; |
| 1224 SilcHashTableList htl; | 1224 SilcHashTableList htl; |
| 1225 SilcChannelUser chu; | 1225 SilcChannelUser chu; |
| 1226 SilcChannelEntry channel = NULL; | 1226 SilcChannelEntry channel = NULL; |
| 1338 return ret; | 1338 return ret; |
| 1339 } | 1339 } |
| 1340 | 1340 |
| 1341 void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) | 1341 void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) |
| 1342 { | 1342 { |
| 1343 SilcPurple sg = gc->proto_data; | 1343 SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 1344 SilcClient client = sg->client; | 1344 SilcClient client = sg->client; |
| 1345 SilcClientConnection conn = sg->conn; | 1345 SilcClientConnection conn = sg->conn; |
| 1346 SilcHashTableList htl; | 1346 SilcHashTableList htl; |
| 1347 SilcChannelUser chu; | 1347 SilcChannelUser chu; |
| 1348 gboolean found = FALSE; | 1348 gboolean found = FALSE; |
| 1382 chu->channel->channel_name, topic, NULL); | 1382 chu->channel->channel_name, topic, NULL); |
| 1383 } | 1383 } |
| 1384 | 1384 |
| 1385 PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc) | 1385 PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc) |
| 1386 { | 1386 { |
| 1387 SilcPurple sg = gc->proto_data; | 1387 SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 1388 SilcClient client = sg->client; | 1388 SilcClient client = sg->client; |
| 1389 SilcClientConnection conn = sg->conn; | 1389 SilcClientConnection conn = sg->conn; |
| 1390 GList *fields = NULL; | 1390 GList *fields = NULL; |
| 1391 PurpleRoomlistField *f; | 1391 PurpleRoomlistField *f; |
| 1392 | 1392 |
| 1417 return sg->roomlist; | 1417 return sg->roomlist; |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 void silcpurple_roomlist_cancel(PurpleRoomlist *list) | 1420 void silcpurple_roomlist_cancel(PurpleRoomlist *list) |
| 1421 { | 1421 { |
| 1422 PurpleConnection *gc = purple_account_get_connection(list->account); | 1422 PurpleAccount *account = purple_roomlist_get_account(list); |
| 1423 PurpleConnection *gc = purple_account_get_connection(account); | |
| 1423 SilcPurple sg; | 1424 SilcPurple sg; |
| 1424 | 1425 |
| 1425 if (!gc) | 1426 if (!gc) |
| 1426 return; | 1427 return; |
| 1427 sg = gc->proto_data; | 1428 sg = purple_connection_get_protocol_data(gc); |
| 1428 | 1429 |
| 1429 purple_roomlist_set_in_progress(list, FALSE); | 1430 purple_roomlist_set_in_progress(list, FALSE); |
| 1430 if (sg->roomlist == list) { | 1431 if (sg->roomlist == list) { |
| 1431 purple_roomlist_unref(sg->roomlist); | 1432 purple_roomlist_unref(sg->roomlist); |
| 1432 sg->roomlist = NULL; | 1433 sg->roomlist = NULL; |
