Mercurial > pidgin
annotate libpurple/protocols/oscar/visibility.c @ 30882:c0337902d62a
This function is now in slp.h, it doesnt need to be here.
author | masca@cpw.pidgin.im |
---|---|
date | Wed, 22 Sep 2010 20:58:43 +0000 |
parents | d48ae82c58ac |
children | 0accc8adb18a |
rev | line source |
---|---|
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
1 /* |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
2 * Purple's oscar protocol plugin |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
3 * This file is the legal property of its developers. |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
4 * Please see the AUTHORS file distributed alongside this file. |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
5 * |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
6 * This library is free software; you can redistribute it and/or |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
8 * License as published by the Free Software Foundation; either |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
9 * version 2 of the License, or (at your option) any later version. |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
10 * |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
11 * This library is distributed in the hope that it will be useful, |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
14 * Lesser General Public License for more details. |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
15 * |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
17 * License along with this library; if not, write to the Free Software |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
30379
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
19 */ |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
20 |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
21 #include "visibility.h" |
30379
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
22 #include "request.h" |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
23 |
30375
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
24 /* 4 separate strings are needed in order to ease translators' job */ |
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
25 #define APPEAR_ONLINE N_("Appear Online") |
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
26 #define DONT_APPEAR_ONLINE N_("Don't Appear Online") |
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
27 #define APPEAR_OFFLINE N_("Appear Offline") |
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
28 #define DONT_APPEAR_OFFLINE N_("Don't Appear Offline") |
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
29 |
30374
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
30 static guint16 |
30380
2d4dd38c5db5
Two small fixes Mark suggested:
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
31 get_buddy_list_type(OscarData *od) |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
32 { |
30374
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
33 PurpleAccount *account = purple_connection_get_account(od->gc); |
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
34 return purple_account_is_status_active(account, OSCAR_STATUS_ID_INVISIBLE) ? AIM_SSI_TYPE_PERMIT : AIM_SSI_TYPE_DENY; |
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
35 } |
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
36 |
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
37 static gboolean |
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
38 is_buddy_on_list(OscarData *od, const char *bname) |
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
39 { |
30380
2d4dd38c5db5
Two small fixes Mark suggested:
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
40 return aim_ssi_itemlist_finditem(od->ssi.local, NULL, bname, get_buddy_list_type(od)) != NULL; |
30374
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
41 } |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
42 |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
43 static void |
30374
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
44 visibility_cb(PurpleBlistNode *node, gpointer whatever) |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
45 { |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
46 PurpleBuddy *buddy = PURPLE_BUDDY(node); |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
47 const char* bname = purple_buddy_get_name(buddy); |
30374
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
48 OscarData *od = purple_connection_get_protocol_data(purple_account_get_connection(purple_buddy_get_account(buddy))); |
30380
2d4dd38c5db5
Two small fixes Mark suggested:
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
49 guint16 list_type = get_buddy_list_type(od); |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
50 |
30374
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
51 if (!is_buddy_on_list(od, bname)) { |
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
52 aim_ssi_add_to_private_list(od, bname, list_type); |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
53 } else { |
30374
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
54 aim_ssi_del_from_private_list(od, bname, list_type); |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
55 } |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
56 } |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
57 |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
58 PurpleMenuAction * |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
59 create_visibility_menu_item(OscarData *od, const char *bname) |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
60 { |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
61 PurpleAccount *account = purple_connection_get_account(od->gc); |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
62 gboolean invisible = purple_account_is_status_active(account, OSCAR_STATUS_ID_INVISIBLE); |
30374
48fe4720d795
Removed callback data that was causing a segfault in Finch, because
ivan.komarov@soc.pidgin.im
parents:
30373
diff
changeset
|
63 gboolean on_list = is_buddy_on_list(od, bname); |
30375
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
64 const gchar *label; |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
65 |
30375
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
66 if (invisible) { |
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
67 label = on_list ? _(DONT_APPEAR_ONLINE) : _(APPEAR_ONLINE); |
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
68 } else { |
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
69 label = on_list ? _(DONT_APPEAR_OFFLINE) : _(APPEAR_OFFLINE); |
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
70 } |
ab7e28b1b478
Gettextized the code and rephrased some of the messages slightly.
ivan.komarov@soc.pidgin.im
parents:
30374
diff
changeset
|
71 return purple_menu_action_new(label, PURPLE_CALLBACK(visibility_cb), NULL, NULL); |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
diff
changeset
|
72 } |
30373
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
73 |
30379
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
74 typedef void (*ShowDialog)(PurplePluginAction *); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
75 |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
76 struct list_remove_data |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
77 { |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
78 PurplePluginAction *action; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
79 ShowDialog show_dialog_again; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
80 OscarData *od; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
81 guint16 list_type; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
82 const gchar *list_name; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
83 }; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
84 |
30373
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
85 static void |
30379
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
86 list_remove_cb(struct list_remove_data *data, PurpleRequestFields *fields) |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
87 { |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
88 ShowDialog show_dialog_again = data->show_dialog_again; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
89 PurplePluginAction *action = data->action; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
90 PurpleRequestField *field = purple_request_fields_get_field(fields, "list-items"); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
91 GList *sels = purple_request_field_list_get_selected(field); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
92 for (; sels; sels = sels->next) { |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
93 const gchar *name = sels->data; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
94 const gchar *bname = purple_request_field_list_get_data(field, name); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
95 |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
96 purple_debug_info("oscar", "Removing %s from %s\n", bname, data->list_name); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
97 |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
98 aim_ssi_del_from_private_list(data->od, bname, data->list_type); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
99 } |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
100 |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
101 g_free(data); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
102 show_dialog_again(action); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
103 } |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
104 |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
105 static void |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
106 list_close_cb(struct list_remove_data *data, gpointer ignored) |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
107 { |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
108 g_free(data); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
109 } |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
110 |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
111 static void |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
112 show_private_list(PurplePluginAction *action, |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
113 guint16 list_type, |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
114 const gchar *list_name, |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
115 const gchar *list_description, |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
116 const gchar *menu_action_name, |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
117 ShowDialog caller) |
30373
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
118 { |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
119 PurpleConnection *gc = (PurpleConnection *) action->context; |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
120 OscarData *od = purple_connection_get_protocol_data(gc); |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
121 PurpleAccount *account = purple_connection_get_account(gc); |
30379
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
122 GSList *buddies, *cur; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
123 gchar *desc; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
124 struct list_remove_data *data; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
125 |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
126 PurpleRequestField *field; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
127 PurpleRequestFields *fields = purple_request_fields_new(); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
128 PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
129 |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
130 purple_request_fields_add_group(fields, group); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
131 |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
132 desc = g_strdup_printf(_("You can add a buddy to this list " |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
133 "by right-clicking on them and " |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
134 "selecting \"%s\""), menu_action_name); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
135 |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
136 field = purple_request_field_list_new("list-items", desc); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
137 g_free(desc); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
138 |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
139 purple_request_field_group_add_field(group, field); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
140 |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
141 purple_request_field_list_set_multi_select(field, TRUE); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
142 purple_request_field_set_required(field, TRUE); |
30373
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
143 |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
144 buddies = purple_find_buddies(account, NULL); |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
145 for (cur = buddies; cur != NULL; cur = cur->next) { |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
146 PurpleBuddy *buddy; |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
147 const gchar *bname; |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
148 |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
149 buddy = cur->data; |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
150 bname = purple_buddy_get_name(buddy); |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
151 if (aim_ssi_itemlist_finditem(od->ssi.local, NULL, bname, list_type)) { |
30379
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
152 const gchar *alias = purple_buddy_get_alias_only(buddy); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
153 char *dname = alias ? g_strdup_printf("%s (%s)", bname, alias) : NULL; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
154 purple_request_field_list_add(field, dname ? dname : bname, (void *)bname); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
155 g_free(dname); |
30373
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
156 } |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
157 } |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
158 |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
159 g_slist_free(buddies); |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
160 |
30379
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
161 data = g_new0(struct list_remove_data, 1); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
162 data->action = action; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
163 data->show_dialog_again = caller; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
164 data->od = od; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
165 data->list_type = list_type; |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
166 data->list_name = list_name; |
30373
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
167 |
30379
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
168 purple_request_fields(gc, list_name, list_description, NULL, |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
169 fields, |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
170 _("Close"), G_CALLBACK(list_close_cb), |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
171 _("Remove"), G_CALLBACK(list_remove_cb), |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
172 account, NULL, NULL, |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
173 data); |
30373
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
174 } |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
175 |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
176 void |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
177 oscar_show_visible_list(PurplePluginAction *action) |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
178 { |
30379
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
179 show_private_list(action, |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
180 AIM_SSI_TYPE_PERMIT, |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
181 _("Visible List"), |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
182 _("These buddies will see " |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
183 "your status when you switch " |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
184 "to \"Invisible\""), |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
185 _(APPEAR_ONLINE), |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
186 oscar_show_visible_list); |
30373
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
187 } |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
188 |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
189 void |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
190 oscar_show_invisible_list(PurplePluginAction *action) |
4e804413b12b
Added a way to view the Visible/Invisible lists.
ivan.komarov@soc.pidgin.im
parents:
30372
diff
changeset
|
191 { |
30379
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
192 show_private_list(action, |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
193 AIM_SSI_TYPE_DENY, |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
194 _("Invisible List"), |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
195 _("These buddies will always see you as offline"), |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
196 _(APPEAR_OFFLINE), |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
197 oscar_show_invisible_list); |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
198 } |
242bcf6b1258
Applied and slightly modified Sadrul's patch (http://pidgin.im/~sadrul/pp/icq-list.patch.txt)
ivan.komarov@soc.pidgin.im
parents:
30378
diff
changeset
|
199 |