Tue, 27 Aug 2013 04:30:39 +0530
Merged soc.2013.gobjectification branch
| 15884 | 1 | /* purple |
| 15030 | 2 | * |
| 15884 | 3 | * Purple is the legal property of its developers, whose names are too numerous |
| 15030 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
| 6 | * | |
| 7 | * This program is free software; you can redistribute it and/or modify | |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19050
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 15030 | 20 | * |
| 21 | */ | |
| 22 | ||
| 30403 | 23 | /* libicq is the ICQ protocol plugin. It is linked against liboscar, |
| 15030 | 24 | * which contains all the shared implementation code with libaim |
| 25 | */ | |
| 26 | ||
|
36530
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
27 | #include "plugins.h" |
| 15030 | 28 | |
| 29 | #include "oscarcommon.h" | |
| 30 | ||
|
24235
46abfb2f03e4
Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23277
diff
changeset
|
31 | static GHashTable * |
|
46abfb2f03e4
Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23277
diff
changeset
|
32 | icq_get_account_text_table(PurpleAccount *account) |
|
46abfb2f03e4
Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23277
diff
changeset
|
33 | { |
|
46abfb2f03e4
Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23277
diff
changeset
|
34 | GHashTable *table; |
|
46abfb2f03e4
Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23277
diff
changeset
|
35 | table = g_hash_table_new(g_str_hash, g_str_equal); |
|
46abfb2f03e4
Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23277
diff
changeset
|
36 | g_hash_table_insert(table, "login_label", (gpointer)_("ICQ UIN...")); |
|
46abfb2f03e4
Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23277
diff
changeset
|
37 | return table; |
|
46abfb2f03e4
Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23277
diff
changeset
|
38 | } |
|
46abfb2f03e4
Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23277
diff
changeset
|
39 | |
|
34312
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33696
diff
changeset
|
40 | static gsize |
|
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33696
diff
changeset
|
41 | icq_get_max_message_size(PurpleConnection *gc) |
|
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33696
diff
changeset
|
42 | { |
|
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33696
diff
changeset
|
43 | /* got from pidgin-otr */ |
|
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33696
diff
changeset
|
44 | return 2346; |
|
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33696
diff
changeset
|
45 | } |
|
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33696
diff
changeset
|
46 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36538
diff
changeset
|
47 | static PurpleProtocol protocol = |
| 15030 | 48 | { |
|
36530
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
49 | "prpl-icq", /* id */ |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
50 | "ICQ", /* name */ |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36538
diff
changeset
|
51 | sizeof(PurpleProtocol), /* struct_size */ |
|
33696
b210b3afb63d
Add some prpl flags to indicate support for auth response messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32338
diff
changeset
|
52 | OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE | OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE, |
| 15030 | 53 | NULL, /* user_splits */ |
| 54 | NULL, /* protocol_options */ | |
|
31806
c9a9c04947a4
Fix setting icons with dimensions greater than 64x64 pixels by scaling
Mark Doliner <markdoliner@pidgin.im>
parents:
31599
diff
changeset
|
55 | {"gif,jpeg,bmp,ico", 0, 0, 64, 64, 7168, PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ |
|
36530
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
56 | oscar_get_actions, /* get_actions */ |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
57 | oscar_list_icon_icq, /* list_icon */ |
| 15524 | 58 | oscar_list_emblem, /* list_emblems */ |
| 15030 | 59 | oscar_status_text, /* status_text */ |
| 60 | oscar_tooltip_text, /* tooltip_text */ | |
| 61 | oscar_status_types, /* status_types */ | |
| 62 | oscar_blist_node_menu, /* blist_node_menu */ | |
| 63 | oscar_chat_info, /* chat_info */ | |
| 64 | oscar_chat_info_defaults, /* chat_info_defaults */ | |
| 65 | oscar_login, /* login */ | |
| 66 | oscar_close, /* close */ | |
| 67 | oscar_send_im, /* send_im */ | |
| 68 | oscar_set_info, /* set_info */ | |
| 69 | oscar_send_typing, /* send_typing */ | |
| 70 | oscar_get_info, /* get_info */ | |
| 71 | oscar_set_status, /* set_status */ | |
| 72 | oscar_set_idle, /* set_idle */ | |
| 73 | oscar_change_passwd, /* change_passwd */ | |
|
32315
2550a39e0285
Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31806
diff
changeset
|
74 | oscar_add_buddy, /* add_buddy */ |
| 15030 | 75 | NULL, /* add_buddies */ |
| 76 | oscar_remove_buddy, /* remove_buddy */ | |
| 77 | NULL, /* remove_buddies */ | |
|
30645
941f22b19796
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30138
diff
changeset
|
78 | NULL, /* add_permit */ |
| 15030 | 79 | oscar_add_deny, /* add_deny */ |
|
30645
941f22b19796
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30138
diff
changeset
|
80 | NULL, /* rem_permit */ |
| 15030 | 81 | oscar_rem_deny, /* rem_deny */ |
|
30645
941f22b19796
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30138
diff
changeset
|
82 | NULL, /* set_permit_deny */ |
| 15030 | 83 | oscar_join_chat, /* join_chat */ |
| 84 | NULL, /* reject_chat */ | |
| 85 | oscar_get_chat_name, /* get_chat_name */ | |
| 86 | oscar_chat_invite, /* chat_invite */ | |
| 87 | oscar_chat_leave, /* chat_leave */ | |
| 88 | NULL, /* chat_whisper */ | |
| 89 | oscar_send_chat, /* chat_send */ | |
| 90 | oscar_keepalive, /* keepalive */ | |
| 91 | NULL, /* register_user */ | |
| 92 | NULL, /* get_cb_info */ | |
| 93 | oscar_alias_buddy, /* alias_buddy */ | |
| 94 | oscar_move_buddy, /* group_buddy */ | |
| 95 | oscar_rename_group, /* rename_group */ | |
| 96 | NULL, /* buddy_free */ | |
| 97 | oscar_convo_closed, /* convo_closed */ | |
| 98 | oscar_normalize, /* normalize */ | |
| 99 | oscar_set_icon, /* set_buddy_icon */ | |
|
19050
78ed2f8cd58d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <markdoliner@pidgin.im>
parents:
18354
diff
changeset
|
100 | oscar_remove_group, /* remove_group */ |
| 15030 | 101 | NULL, /* get_cb_real_name */ |
| 102 | NULL, /* set_chat_topic */ | |
| 103 | NULL, /* find_blist_chat */ | |
| 104 | NULL, /* roomlist_get_list */ | |
| 105 | NULL, /* roomlist_cancel */ | |
| 106 | NULL, /* roomlist_expand_category */ | |
| 107 | oscar_can_receive_file, /* can_receive_file */ | |
| 108 | oscar_send_file, /* send_file */ | |
| 109 | oscar_new_xfer, /* new_xfer */ | |
| 110 | oscar_offline_message, /* offline_message */ | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
111 | NULL, /* whiteboard_protocol_ops */ |
| 15185 | 112 | NULL, /* send_raw */ |
| 113 | NULL, /* roomlist_room_serialize */ | |
|
22244
221f48b173e3
Update some comments in oscar's prpl callback structs
Mark Doliner <markdoliner@pidgin.im>
parents:
20288
diff
changeset
|
114 | NULL, /* unregister_user */ |
|
221f48b173e3
Update some comments in oscar's prpl callback structs
Mark Doliner <markdoliner@pidgin.im>
parents:
20288
diff
changeset
|
115 | NULL, /* send_attention */ |
|
221f48b173e3
Update some comments in oscar's prpl callback structs
Mark Doliner <markdoliner@pidgin.im>
parents:
20288
diff
changeset
|
116 | NULL, /* get_attention_types */ |
|
24235
46abfb2f03e4
Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23277
diff
changeset
|
117 | icq_get_account_text_table, /* get_account_text_table */ |
|
23707
480f94157418
propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
118 | NULL, /* initiate_media */ |
| 29404 | 119 | NULL, /* can_do_media */ |
|
24912
9ae8349f0353
Move the mood UI for ICQ into Pidgin. It still uses the new request API
Richard Laager <rlaager@pidgin.im>
parents:
24235
diff
changeset
|
120 | oscar_get_purple_moods, /* get_moods */ |
|
30138
cca9685df785
Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents:
29859
diff
changeset
|
121 | NULL, /* set_public_alias */ |
|
34312
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33696
diff
changeset
|
122 | NULL, /* get_public_alias */ |
|
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33696
diff
changeset
|
123 | icq_get_max_message_size /* get_max_message_size */ |
| 15030 | 124 | }; |
| 125 | ||
|
36530
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
126 | static PurplePluginInfo * |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
127 | plugin_query(GError **error) |
| 15030 | 128 | { |
|
36530
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
129 | return purple_plugin_info_new( |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
130 | "id", "prpl-icq", |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
131 | "name", "ICQ", |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
132 | "version", DISPLAY_VERSION, |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
133 | "category", N_("Protocol"), |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
134 | "summary", N_("ICQ Protocol Plugin"), |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
135 | "description", N_("ICQ Protocol Plugin"), |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
136 | "website", PURPLE_WEBSITE, |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
137 | "abi-version", PURPLE_ABI_VERSION, |
| 36536 | 138 | "flags", GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL | |
| 139 | GPLUGIN_PLUGIN_INFO_FLAGS_LOAD_ON_QUERY, | |
|
36530
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
140 | NULL |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
141 | ); |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
142 | } |
| 15030 | 143 | |
|
36530
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
144 | static gboolean |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
145 | plugin_load(PurplePlugin *plugin, GError **error) |
| 15030 | 146 | { |
| 15884 | 147 | PurpleAccountOption *option; |
| 15030 | 148 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36538
diff
changeset
|
149 | oscar_init(&protocol, TRUE); |
| 15030 | 150 | |
| 15884 | 151 | option = purple_account_option_string_new(_("Encoding"), "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36538
diff
changeset
|
152 | protocol.protocol_options = g_list_append(protocol.protocol_options, option); |
|
36530
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
153 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36538
diff
changeset
|
154 | purple_protocols_add(&protocol); |
|
36530
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
155 | |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
156 | return TRUE; |
| 15030 | 157 | } |
| 158 | ||
|
36530
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
159 | static gboolean |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
160 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
161 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36538
diff
changeset
|
162 | purple_protocols_remove(&protocol); |
|
36530
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
163 | |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
164 | return TRUE; |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
165 | } |
|
b8caab360c96
Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33696
diff
changeset
|
166 | |
| 36538 | 167 | PURPLE_PLUGIN_INIT(icq, plugin_query, plugin_load, plugin_unload); |