Thu, 21 May 2020 21:21:54 -0500
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
| 981 | 1 | /* |
| 15884 | 2 | * purple |
| 981 | 3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
|
6460
fc288e7221ca
[gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
7 | * |
| 981 | 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * 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:
19692
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 981 | 21 | * |
| 22 | */ | |
|
40441
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40128
diff
changeset
|
23 | |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40128
diff
changeset
|
24 | #include <glib/gi18n-lib.h> |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40128
diff
changeset
|
25 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
26 | #include "internal.h" |
|
5945
941f14d90d22
[gaim-migrate @ 6386]
Christian Hammond <chipx86@chipx86.com>
parents:
5943
diff
changeset
|
27 | #include "conversation.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
28 | #include "debug.h" |
|
24519
d4af3d043211
Improve our NetworkManager support in a couple of ways:
Richard Laager <rlaager@pidgin.im>
parents:
23875
diff
changeset
|
29 | #include "network.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
30 | #include "notify.h" |
|
36543
a8c3fecee2d3
Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents:
36537
diff
changeset
|
31 | #include "protocol.h" |
|
39970
cc7d4ff5a205
rename accountopt.[ch] to purpleaccountoption.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39921
diff
changeset
|
32 | #include "purpleaccountoption.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
33 | #include "request.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
34 | #include "util.h" |
| 3738 | 35 | |
|
36375
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
36 | static GHashTable *protocols = NULL; |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
37 | |
|
36624
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
38 | /************************************************************************** |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
39 | * GBoxed code for PurpleProtocolChatEntry |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
40 | **************************************************************************/ |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
41 | |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
42 | static PurpleProtocolChatEntry * |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
43 | purple_protocol_chat_entry_copy(PurpleProtocolChatEntry *pce) |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
44 | { |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
45 | PurpleProtocolChatEntry *pce_copy; |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
46 | |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
47 | g_return_val_if_fail(pce != NULL, NULL); |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
48 | |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
49 | pce_copy = g_new(PurpleProtocolChatEntry, 1); |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
50 | *pce_copy = *pce; |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
51 | |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
52 | return pce_copy; |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
53 | } |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
54 | |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
55 | GType |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
56 | purple_protocol_chat_entry_get_type(void) |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
57 | { |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
58 | static GType type = 0; |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
59 | |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
60 | if (type == 0) { |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
61 | type = g_boxed_type_register_static("PurpleProtocolChatEntry", |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
62 | (GBoxedCopyFunc)purple_protocol_chat_entry_copy, |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
63 | (GBoxedFreeFunc)g_free); |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
64 | } |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
65 | |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
66 | return type; |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
67 | } |
|
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
68 | |
|
22225
6cd802a8c5ad
This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21720
diff
changeset
|
69 | /**************************************************************************/ |
| 37075 | 70 | /* Protocol API */ |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
71 | /**************************************************************************/ |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
72 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
73 | purple_protocol_got_account_idle(PurpleAccount *account, gboolean idle, |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
74 | time_t idle_time) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
75 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
76 | g_return_if_fail(account != NULL); |
| 15884 | 77 | g_return_if_fail(purple_account_is_connected(account)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
78 | |
| 15884 | 79 | purple_presence_set_idle(purple_account_get_presence(account), |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
80 | idle, idle_time); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
81 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
82 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
83 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
84 | purple_protocol_got_account_login_time(PurpleAccount *account, time_t login_time) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
85 | { |
| 15884 | 86 | PurplePresence *presence; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
87 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
88 | g_return_if_fail(account != NULL); |
| 15884 | 89 | g_return_if_fail(purple_account_is_connected(account)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
90 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
91 | if (login_time == 0) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
92 | login_time = time(NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
93 | |
| 15884 | 94 | presence = purple_account_get_presence(account); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
95 | |
| 15884 | 96 | purple_presence_set_login_time(presence, login_time); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
97 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
98 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
99 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
100 | purple_protocol_got_account_status(PurpleAccount *account, const char *status_id, ...) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
101 | { |
| 15884 | 102 | PurplePresence *presence; |
| 103 | PurpleStatus *status; | |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13335
diff
changeset
|
104 | va_list args; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
105 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
106 | g_return_if_fail(account != NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
107 | g_return_if_fail(status_id != NULL); |
| 15884 | 108 | g_return_if_fail(purple_account_is_connected(account)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
109 | |
| 15884 | 110 | presence = purple_account_get_presence(account); |
| 111 | status = purple_presence_get_status(presence, status_id); | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
112 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
113 | g_return_if_fail(status != NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
114 | |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13335
diff
changeset
|
115 | va_start(args, status_id); |
| 15884 | 116 | purple_status_set_active_with_attrs(status, TRUE, args); |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13335
diff
changeset
|
117 | va_end(args); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
118 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
119 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
120 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
121 | purple_protocol_got_account_actions(PurpleAccount *account) |
|
26871
d62964222795
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents:
26746
diff
changeset
|
122 | { |
|
d62964222795
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents:
26746
diff
changeset
|
123 | |
|
d62964222795
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents:
26746
diff
changeset
|
124 | g_return_if_fail(account != NULL); |
|
d62964222795
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents:
26746
diff
changeset
|
125 | g_return_if_fail(purple_account_is_connected(account)); |
|
d62964222795
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents:
26746
diff
changeset
|
126 | |
|
36868
1aca7f52f1ef
Backed out the previous 4 changesets. GSignals do not seem feasible with pidgin's architecture using any method.
Ankit Vani <a@nevitus.org>
parents:
36867
diff
changeset
|
127 | purple_signal_emit(purple_accounts_get_handle(), "account-actions-changed", |
|
1aca7f52f1ef
Backed out the previous 4 changesets. GSignals do not seem feasible with pidgin's architecture using any method.
Ankit Vani <a@nevitus.org>
parents:
36867
diff
changeset
|
128 | account); |
|
26871
d62964222795
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents:
26746
diff
changeset
|
129 | } |
|
d62964222795
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents:
26746
diff
changeset
|
130 | |
|
d62964222795
Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents:
26746
diff
changeset
|
131 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
132 | purple_protocol_got_user_idle(PurpleAccount *account, const char *name, |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
133 | gboolean idle, time_t idle_time) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
134 | { |
| 15884 | 135 | PurplePresence *presence; |
|
18177
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
136 | GSList *list; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
137 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
138 | g_return_if_fail(account != NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
139 | g_return_if_fail(name != NULL); |
|
25428
05aef3d5e63e
I think it's reasonable for prpls to call purple_prpl_got_user_idle()
Mark Doliner <markdoliner@pidgin.im>
parents:
24519
diff
changeset
|
140 | g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
141 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
142 | if ((list = purple_blist_find_buddies(account, name)) == NULL) |
|
12176
ee1aea253ce3
[gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12126
diff
changeset
|
143 | return; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
144 | |
|
18177
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
145 | while (list) { |
|
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
146 | presence = purple_buddy_get_presence(list->data); |
|
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
147 | list = g_slist_delete_link(list, list); |
|
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
148 | purple_presence_set_idle(presence, idle, idle_time); |
|
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
149 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
150 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
151 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
152 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
153 | purple_protocol_got_user_login_time(PurpleAccount *account, const char *name, |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
154 | time_t login_time) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
155 | { |
|
18177
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
156 | GSList *list; |
| 15884 | 157 | PurplePresence *presence; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
158 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
159 | g_return_if_fail(account != NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
160 | g_return_if_fail(name != NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
161 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
162 | if ((list = purple_blist_find_buddies(account, name)) == NULL) |
|
12176
ee1aea253ce3
[gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12126
diff
changeset
|
163 | return; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
164 | |
|
12176
ee1aea253ce3
[gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12126
diff
changeset
|
165 | if (login_time == 0) |
|
ee1aea253ce3
[gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12126
diff
changeset
|
166 | login_time = time(NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
167 | |
|
18177
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
168 | while (list) { |
|
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
169 | PurpleBuddy *buddy = list->data; |
|
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
170 | presence = purple_buddy_get_presence(buddy); |
|
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
171 | list = g_slist_delete_link(list, list); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
172 | |
|
18177
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
173 | if (purple_presence_get_login_time(presence) != login_time) |
|
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
174 | { |
|
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
175 | purple_presence_set_login_time(presence, login_time); |
|
15212
2919bfea7c4a
[gaim-migrate @ 17936]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
176 | |
|
18177
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
177 | purple_signal_emit(purple_blist_get_handle(), "buddy-got-login-time", buddy); |
|
6733196cafc6
Update the idleness and login-time for all the blistnodes of the same buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16958
diff
changeset
|
178 | } |
|
15311
f5cf28c6e665
[gaim-migrate @ 18039]
Evan Schoenberg <evands@pidgin.im>
parents:
15212
diff
changeset
|
179 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
180 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
181 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
182 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
183 | purple_protocol_got_user_status(PurpleAccount *account, const char *name, |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13335
diff
changeset
|
184 | const char *status_id, ...) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
185 | { |
|
16958
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
186 | GSList *list, *l; |
| 15884 | 187 | PurpleBuddy *buddy; |
| 188 | PurplePresence *presence; | |
| 189 | PurpleStatus *status; | |
| 190 | PurpleStatus *old_status; | |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13335
diff
changeset
|
191 | va_list args; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
192 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
193 | g_return_if_fail(account != NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
194 | g_return_if_fail(name != NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
195 | g_return_if_fail(status_id != NULL); |
| 15884 | 196 | g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
197 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
198 | if((list = purple_blist_find_buddies(account, name)) == NULL) |
|
12176
ee1aea253ce3
[gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12126
diff
changeset
|
199 | return; |
|
ee1aea253ce3
[gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12126
diff
changeset
|
200 | |
|
16958
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
201 | for(l = list; l != NULL; l = l->next) { |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
202 | buddy = l->data; |
|
12176
ee1aea253ce3
[gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12126
diff
changeset
|
203 | |
|
16958
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
204 | presence = purple_buddy_get_presence(buddy); |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
205 | status = purple_presence_get_status(presence, status_id); |
|
12176
ee1aea253ce3
[gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12126
diff
changeset
|
206 | |
|
16958
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
207 | if(NULL == status) |
| 27786 | 208 | /* |
| 209 | * TODO: This should never happen, right? We should call | |
| 210 | * g_warning() or something. | |
| 211 | */ | |
|
16958
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
212 | continue; |
|
12176
ee1aea253ce3
[gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12126
diff
changeset
|
213 | |
|
16958
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
214 | old_status = purple_presence_get_active_status(presence); |
|
12176
ee1aea253ce3
[gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12126
diff
changeset
|
215 | |
|
16958
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
216 | va_start(args, status_id); |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
217 | purple_status_set_active_with_attrs(status, TRUE, args); |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
218 | va_end(args); |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
219 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
220 | purple_buddy_update_status(buddy, old_status); |
|
16958
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
221 | } |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
222 | |
|
12126
3b70215e9630
[gaim-migrate @ 14426]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12108
diff
changeset
|
223 | g_slist_free(list); |
|
12654
2e25e75190c4
[gaim-migrate @ 14997]
Mark Doliner <markdoliner@pidgin.im>
parents:
12377
diff
changeset
|
224 | |
|
27596
bc7058e10c04
Make the comment reflect that we are actually just stopping the typing
Etan Reisner <deryni@pidgin.im>
parents:
26871
diff
changeset
|
225 | /* The buddy is no longer online, they are therefore by definition not |
|
bc7058e10c04
Make the comment reflect that we are actually just stopping the typing
Etan Reisner <deryni@pidgin.im>
parents:
26871
diff
changeset
|
226 | * still typing to us. */ |
|
29544
dc16ec0027ae
Use purple_prpl_got_media_caps in purple_prpl_got_user_status to remove media
Michael Ruprecht <maiku@pidgin.im>
parents:
29543
diff
changeset
|
227 | if (!purple_status_is_online(status)) { |
| 35501 | 228 | purple_serv_got_typing_stopped(purple_account_get_connection(account), name); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
229 | purple_protocol_got_media_caps(account, name); |
|
29544
dc16ec0027ae
Use purple_prpl_got_media_caps in purple_prpl_got_user_status to remove media
Michael Ruprecht <maiku@pidgin.im>
parents:
29543
diff
changeset
|
230 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
231 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
232 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
233 | void purple_protocol_got_user_status_deactive(PurpleAccount *account, const char *name, |
|
15588
e6e89a427ed5
Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
234 | const char *status_id) |
|
e6e89a427ed5
Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
235 | { |
|
16958
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
236 | GSList *list, *l; |
| 15884 | 237 | PurpleBuddy *buddy; |
| 238 | PurplePresence *presence; | |
| 239 | PurpleStatus *status; | |
|
15588
e6e89a427ed5
Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
240 | |
|
e6e89a427ed5
Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
241 | g_return_if_fail(account != NULL); |
|
e6e89a427ed5
Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
242 | g_return_if_fail(name != NULL); |
|
e6e89a427ed5
Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
243 | g_return_if_fail(status_id != NULL); |
| 15884 | 244 | g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); |
|
15588
e6e89a427ed5
Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
245 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
246 | if((list = purple_blist_find_buddies(account, name)) == NULL) |
|
15588
e6e89a427ed5
Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
247 | return; |
|
e6e89a427ed5
Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
248 | |
|
16958
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
249 | for(l = list; l != NULL; l = l->next) { |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
250 | buddy = l->data; |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
251 | |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
252 | presence = purple_buddy_get_presence(buddy); |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
253 | status = purple_presence_get_status(presence, status_id); |
|
15588
e6e89a427ed5
Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
254 | |
|
16958
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
255 | if(NULL == status) |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
256 | continue; |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
257 | |
|
19692
06e6aba21930
Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19654
diff
changeset
|
258 | if (purple_status_is_active(status)) { |
|
06e6aba21930
Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19654
diff
changeset
|
259 | purple_status_set_active(status, FALSE); |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
260 | purple_buddy_update_status(buddy, status); |
|
19692
06e6aba21930
Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19654
diff
changeset
|
261 | } |
|
16958
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
262 | } |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
263 | |
|
c95f16df72f6
this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
264 | g_slist_free(list); |
|
15588
e6e89a427ed5
Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
265 | } |
|
e6e89a427ed5
Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
266 | |
|
12304
e849bc5e8d5d
[gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12176
diff
changeset
|
267 | static void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
268 | do_protocol_change_account_status(PurpleAccount *account, |
| 15884 | 269 | PurpleStatus *old_status, PurpleStatus *new_status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
270 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
271 | PurpleProtocol *protocol; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
272 | |
| 15884 | 273 | if (purple_status_is_online(new_status) && |
|
24519
d4af3d043211
Improve our NetworkManager support in a couple of ways:
Richard Laager <rlaager@pidgin.im>
parents:
23875
diff
changeset
|
274 | purple_account_is_disconnected(account) && |
|
d4af3d043211
Improve our NetworkManager support in a couple of ways:
Richard Laager <rlaager@pidgin.im>
parents:
23875
diff
changeset
|
275 | purple_network_is_available()) |
|
11718
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
11628
diff
changeset
|
276 | { |
| 15884 | 277 | purple_account_connect(account); |
|
11718
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
11628
diff
changeset
|
278 | return; |
|
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
11628
diff
changeset
|
279 | } |
|
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
11628
diff
changeset
|
280 | |
| 15884 | 281 | if (!purple_status_is_online(new_status)) |
|
14224
d6d41ff969df
[gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14097
diff
changeset
|
282 | { |
| 15884 | 283 | if (!purple_account_is_disconnected(account)) |
| 284 | purple_account_disconnect(account); | |
|
34146
99bad5c80d1e
More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34029
diff
changeset
|
285 | /* Clear out the unsaved password if we switch to offline status */ |
|
99bad5c80d1e
More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34029
diff
changeset
|
286 | if (!purple_account_get_remember_password(account)) |
|
99bad5c80d1e
More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34029
diff
changeset
|
287 | purple_account_set_password(account, NULL, NULL, NULL); |
|
34019
bc87f596bb4c
compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents:
34018
diff
changeset
|
288 | |
|
14224
d6d41ff969df
[gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14097
diff
changeset
|
289 | return; |
|
d6d41ff969df
[gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14097
diff
changeset
|
290 | } |
|
11718
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
11628
diff
changeset
|
291 | |
| 15884 | 292 | if (purple_account_is_connecting(account)) |
|
12108
a74fd0d6b79c
[gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11948
diff
changeset
|
293 | /* |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36631
diff
changeset
|
294 | * We don't need to call the set_status protocol function because |
|
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36631
diff
changeset
|
295 | * the protocol will take care of setting its status during the |
|
12108
a74fd0d6b79c
[gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11948
diff
changeset
|
296 | * connection process. |
|
a74fd0d6b79c
[gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11948
diff
changeset
|
297 | */ |
|
a74fd0d6b79c
[gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11948
diff
changeset
|
298 | return; |
|
a74fd0d6b79c
[gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11948
diff
changeset
|
299 | |
|
36624
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
300 | protocol = purple_protocols_find(purple_account_get_protocol_id(account)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
301 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
302 | if (protocol == NULL) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
303 | return; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
304 | |
|
36619
bade26478caa
Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents:
36617
diff
changeset
|
305 | if (!purple_account_is_disconnected(account)) |
| 36719 | 306 | purple_protocol_server_iface_set_status(protocol, account, new_status); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
307 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
308 | |
|
12304
e849bc5e8d5d
[gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12176
diff
changeset
|
309 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
310 | purple_protocol_change_account_status(PurpleAccount *account, |
| 15884 | 311 | PurpleStatus *old_status, PurpleStatus *new_status) |
|
12304
e849bc5e8d5d
[gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12176
diff
changeset
|
312 | { |
|
e849bc5e8d5d
[gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12176
diff
changeset
|
313 | g_return_if_fail(account != NULL); |
|
e849bc5e8d5d
[gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12176
diff
changeset
|
314 | g_return_if_fail(new_status != NULL); |
|
21720
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20115
diff
changeset
|
315 | g_return_if_fail(!purple_status_is_exclusive(new_status) || old_status != NULL); |
|
12304
e849bc5e8d5d
[gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12176
diff
changeset
|
316 | |
|
37679
6ff708c38c04
Add "account-status-changing" signal from instantbird
Florian Quèze <florian@instantbird.org>
parents:
37148
diff
changeset
|
317 | purple_signal_emit(purple_accounts_get_handle(), "account-status-changing", |
|
6ff708c38c04
Add "account-status-changing" signal from instantbird
Florian Quèze <florian@instantbird.org>
parents:
37148
diff
changeset
|
318 | account, old_status, new_status); |
|
6ff708c38c04
Add "account-status-changing" signal from instantbird
Florian Quèze <florian@instantbird.org>
parents:
37148
diff
changeset
|
319 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
320 | do_protocol_change_account_status(account, old_status, new_status); |
|
12304
e849bc5e8d5d
[gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12176
diff
changeset
|
321 | |
|
36868
1aca7f52f1ef
Backed out the previous 4 changesets. GSignals do not seem feasible with pidgin's architecture using any method.
Ankit Vani <a@nevitus.org>
parents:
36867
diff
changeset
|
322 | purple_signal_emit(purple_accounts_get_handle(), "account-status-changed", |
|
1aca7f52f1ef
Backed out the previous 4 changesets. GSignals do not seem feasible with pidgin's architecture using any method.
Ankit Vani <a@nevitus.org>
parents:
36867
diff
changeset
|
323 | account, old_status, new_status); |
|
12304
e849bc5e8d5d
[gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12176
diff
changeset
|
324 | } |
|
e849bc5e8d5d
[gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12176
diff
changeset
|
325 | |
|
10006
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
326 | GList * |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
327 | purple_protocol_get_statuses(PurpleAccount *account, PurplePresence *presence) |
|
10006
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
328 | { |
|
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
329 | GList *statuses = NULL; |
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
18177
diff
changeset
|
330 | GList *l; |
| 15884 | 331 | PurpleStatus *status; |
|
10006
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
332 | |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10052
diff
changeset
|
333 | g_return_val_if_fail(account != NULL, NULL); |
|
10006
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
334 | g_return_val_if_fail(presence != NULL, NULL); |
|
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
335 | |
| 15884 | 336 | for (l = purple_account_get_status_types(account); l != NULL; l = l->next) |
|
10006
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
337 | { |
| 15884 | 338 | status = purple_status_new((PurpleStatusType *)l->data, presence); |
|
15657
a9e38c097d28
sf patch #1655057, from Peter Tang
Mark Doliner <markdoliner@pidgin.im>
parents:
15588
diff
changeset
|
339 | statuses = g_list_prepend(statuses, status); |
|
10006
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
340 | } |
|
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
341 | |
|
15657
a9e38c097d28
sf patch #1655057, from Peter Tang
Mark Doliner <markdoliner@pidgin.im>
parents:
15588
diff
changeset
|
342 | statuses = g_list_reverse(statuses); |
|
11730
649c38d2a8ab
[gaim-migrate @ 14021]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11718
diff
changeset
|
343 | |
|
10006
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
344 | return statuses; |
|
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
345 | } |
|
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
346 | |
|
29487
1fa2077fb506
Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents:
29486
diff
changeset
|
347 | static void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
348 | purple_protocol_attention(PurpleConversation *conv, const char *who, |
|
29487
1fa2077fb506
Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents:
29486
diff
changeset
|
349 | guint type, PurpleMessageFlags flags, time_t mtime) |
|
1fa2077fb506
Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents:
29486
diff
changeset
|
350 | { |
|
1fa2077fb506
Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents:
29486
diff
changeset
|
351 | PurpleAccount *account = purple_conversation_get_account(conv); |
|
1fa2077fb506
Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents:
29486
diff
changeset
|
352 | purple_signal_emit(purple_conversations_get_handle(), |
|
1fa2077fb506
Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents:
29486
diff
changeset
|
353 | flags == PURPLE_MESSAGE_SEND ? "sent-attention" : "got-attention", |
|
1fa2077fb506
Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents:
29486
diff
changeset
|
354 | account, who, conv, type); |
|
1fa2077fb506
Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents:
29486
diff
changeset
|
355 | } |
|
1fa2077fb506
Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents:
29486
diff
changeset
|
356 | |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
357 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
358 | purple_protocol_send_attention(PurpleConnection *gc, const char *who, guint type_code) |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
359 | { |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
360 | PurpleAttentionType *attn; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
361 | PurpleProtocol *protocol; |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34627
diff
changeset
|
362 | PurpleIMConversation *im; |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
363 | PurpleBuddy *buddy; |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25869
diff
changeset
|
364 | const char *alias; |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
365 | gchar *description; |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
366 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
367 | g_return_if_fail(gc != NULL); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
368 | g_return_if_fail(who != NULL); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
369 | |
|
36624
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
370 | protocol = purple_protocols_find(purple_account_get_protocol_id(purple_connection_get_account(gc))); |
|
38859
ed15916ec9ed
First pass at moving attention to it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
38358
diff
changeset
|
371 | g_return_if_fail(PURPLE_IS_PROTOCOL_ATTENTION(protocol)); |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
372 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32554
diff
changeset
|
373 | attn = purple_get_attention_type_from_code(purple_connection_get_account(gc), type_code); |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
374 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
375 | if ((buddy = purple_blist_find_buddy(purple_connection_get_account(gc), who)) != NULL) |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
376 | alias = purple_buddy_get_contact_alias(buddy); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
377 | else |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
378 | alias = who; |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
379 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
380 | if (attn && purple_attention_type_get_outgoing_desc(attn)) { |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
381 | description = g_strdup_printf(purple_attention_type_get_outgoing_desc(attn), alias); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
382 | } else { |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
383 | description = g_strdup_printf(_("Requesting %s's attention..."), alias); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
384 | } |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25869
diff
changeset
|
385 | |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
386 | purple_debug_info("server", "serv_send_attention: sending '%s' to %s\n", |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
387 | description, who); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
388 | |
|
38859
ed15916ec9ed
First pass at moving attention to it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
38358
diff
changeset
|
389 | if (!purple_protocol_attention_send(PURPLE_PROTOCOL_ATTENTION(protocol), gc, who, type_code)) |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
390 | return; |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
391 | |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34627
diff
changeset
|
392 | im = purple_im_conversation_new(purple_connection_get_account(gc), who); |
|
36084
2172bd6dad3e
Add purple_conversation_write_system_message
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35972
diff
changeset
|
393 | purple_conversation_write_system_message(PURPLE_CONVERSATION(im), description, 0); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
394 | purple_protocol_attention(PURPLE_CONVERSATION(im), who, type_code, PURPLE_MESSAGE_SEND, time(NULL)); |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
395 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
396 | g_free(description); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
397 | } |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
398 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
399 | static void |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
400 | got_attention(PurpleConnection *gc, int id, const char *who, guint type_code) |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
401 | { |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
402 | PurpleMessageFlags flags; |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
403 | PurpleAttentionType *attn; |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
404 | PurpleBuddy *buddy; |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
405 | const char *alias; |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
406 | gchar *description; |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
407 | time_t mtime; |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
408 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
409 | mtime = time(NULL); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
410 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32554
diff
changeset
|
411 | attn = purple_get_attention_type_from_code(purple_connection_get_account(gc), type_code); |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
412 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
413 | /* PURPLE_MESSAGE_NOTIFY is for attention messages. */ |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
414 | flags = PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_RECV; |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
415 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
416 | /* TODO: if (attn->icon_name) is non-null, use it to lookup an emoticon and display |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
417 | * it next to the attention command. And if it is null, display a generic icon. */ |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
418 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
419 | if ((buddy = purple_blist_find_buddy(purple_connection_get_account(gc), who)) != NULL) |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
420 | alias = purple_buddy_get_contact_alias(buddy); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
421 | else |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
422 | alias = who; |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
423 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
424 | if (attn && purple_attention_type_get_incoming_desc(attn)) { |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
425 | description = g_strdup_printf(purple_attention_type_get_incoming_desc(attn), alias); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
426 | } else { |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
427 | description = g_strdup_printf(_("%s has requested your attention!"), alias); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
428 | } |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
429 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
430 | purple_debug_info("server", "got_attention: got '%s' from %s\n", |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
431 | description, who); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
432 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
433 | if (id == -1) |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35472
diff
changeset
|
434 | purple_serv_got_im(gc, who, description, flags, mtime); |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
435 | else |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35472
diff
changeset
|
436 | purple_serv_got_chat_in(gc, id, who, flags, description, mtime); |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
437 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
438 | /* TODO: sounds (depending on PurpleAttentionType), shaking, etc. */ |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
439 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
440 | g_free(description); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
441 | } |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
442 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
443 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
444 | purple_protocol_got_attention(PurpleConnection *gc, const char *who, guint type_code) |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
445 | { |
|
29485
ee00ab964bcb
Let _got_attention call _conversation_attention, instead of having prpls do it
Marcus Lundblad <malu@pidgin.im>
parents:
29483
diff
changeset
|
446 | PurpleConversation *conv = NULL; |
|
ee00ab964bcb
Let _got_attention call _conversation_attention, instead of having prpls do it
Marcus Lundblad <malu@pidgin.im>
parents:
29483
diff
changeset
|
447 | PurpleAccount *account = purple_connection_get_account(gc); |
|
ee00ab964bcb
Let _got_attention call _conversation_attention, instead of having prpls do it
Marcus Lundblad <malu@pidgin.im>
parents:
29483
diff
changeset
|
448 | |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
449 | got_attention(gc, -1, who, type_code); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29670
diff
changeset
|
450 | conv = |
|
34625
03d62b1660fc
Refactor code to remove conversation type from some instances of purple_conversations_find_with_account()
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
451 | purple_conversations_find_with_account(who, account); |
|
29485
ee00ab964bcb
Let _got_attention call _conversation_attention, instead of having prpls do it
Marcus Lundblad <malu@pidgin.im>
parents:
29483
diff
changeset
|
452 | if (conv) |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
453 | purple_protocol_attention(conv, who, type_code, PURPLE_MESSAGE_RECV, |
|
29485
ee00ab964bcb
Let _got_attention call _conversation_attention, instead of having prpls do it
Marcus Lundblad <malu@pidgin.im>
parents:
29483
diff
changeset
|
454 | time(NULL)); |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
455 | } |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
456 | |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
457 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
458 | purple_protocol_got_attention_in_chat(PurpleConnection *gc, int id, const char *who, guint type_code) |
|
23875
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
459 | { |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
460 | got_attention(gc, id, who, type_code); |
|
d7e5f66cbfc9
Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22251
diff
changeset
|
461 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
462 | |
|
26495
52846ebe1c7d
Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26482
diff
changeset
|
463 | gboolean |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
464 | purple_protocol_initiate_media(PurpleAccount *account, |
|
26099
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
465 | const char *who, |
|
26108
8d0fd2f195aa
Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents:
26107
diff
changeset
|
466 | PurpleMediaSessionType type) |
|
26099
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
467 | { |
|
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
468 | #ifdef USE_VV |
|
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
469 | PurpleConnection *gc = NULL; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
470 | PurpleProtocol *protocol = NULL; |
|
26099
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
471 | |
|
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
472 | if (account) |
|
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
473 | gc = purple_account_get_connection(account); |
|
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
474 | if (gc) |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36620
diff
changeset
|
475 | protocol = purple_connection_get_protocol(gc); |
|
26099
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
476 | |
|
36619
bade26478caa
Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents:
36617
diff
changeset
|
477 | if (protocol) { |
|
26099
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
478 | /* should check that the protocol supports this media type here? */ |
| 36719 | 479 | return purple_protocol_media_iface_initiate_session(protocol, account, who, type); |
|
26495
52846ebe1c7d
Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26482
diff
changeset
|
480 | } else |
|
26099
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
481 | #endif |
|
26495
52846ebe1c7d
Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26482
diff
changeset
|
482 | return FALSE; |
|
26099
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
483 | } |
|
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
484 | |
|
26316
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26260
diff
changeset
|
485 | PurpleMediaCaps |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
486 | purple_protocol_get_media_caps(PurpleAccount *account, const char *who) |
|
26099
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
487 | { |
|
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
488 | #ifdef USE_VV |
|
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
489 | PurpleConnection *gc = NULL; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
490 | PurpleProtocol *protocol = NULL; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29670
diff
changeset
|
491 | |
|
26099
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
492 | if (account) |
|
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
493 | gc = purple_account_get_connection(account); |
|
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
494 | if (gc) |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36620
diff
changeset
|
495 | protocol = purple_connection_get_protocol(gc); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29670
diff
changeset
|
496 | |
|
36619
bade26478caa
Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents:
36617
diff
changeset
|
497 | if (protocol) |
| 36719 | 498 | return purple_protocol_media_iface_get_caps(protocol, account, who); |
|
26099
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
499 | #endif |
|
26316
950c0d491c0d
Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26260
diff
changeset
|
500 | return PURPLE_MEDIA_CAPS_NONE; |
|
26099
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
501 | } |
|
2ba28e840a95
Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
22251
diff
changeset
|
502 | |
|
29543
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
503 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
504 | purple_protocol_got_media_caps(PurpleAccount *account, const char *name) |
|
29543
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
505 | { |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
506 | #ifdef USE_VV |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
507 | GSList *list; |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
508 | |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
509 | g_return_if_fail(account != NULL); |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
510 | g_return_if_fail(name != NULL); |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
511 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
512 | if ((list = purple_blist_find_buddies(account, name)) == NULL) |
|
29543
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
513 | return; |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
514 | |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
515 | while (list) { |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
516 | PurpleBuddy *buddy = list->data; |
|
29670
c1d3cb9db1d7
update prpl.c to use the new purple_buddy_[gs]et_media_caps api
Gary Kramlich <grim@reaperworld.com>
parents:
29653
diff
changeset
|
517 | PurpleMediaCaps oldcaps = purple_buddy_get_media_caps(buddy); |
|
c1d3cb9db1d7
update prpl.c to use the new purple_buddy_[gs]et_media_caps api
Gary Kramlich <grim@reaperworld.com>
parents:
29653
diff
changeset
|
518 | PurpleMediaCaps newcaps = 0; |
|
29547
debae7802d68
Essentially normalize the username passed to purple_prpl_got_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
29546
diff
changeset
|
519 | const gchar *bname = purple_buddy_get_name(buddy); |
|
29543
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
520 | list = g_slist_delete_link(list, list); |
|
29546
5858906c0f7b
Add media_caps to PurpleBuddy structure and use it to determine the old caps
Michael Ruprecht <maiku@pidgin.im>
parents:
29544
diff
changeset
|
521 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29670
diff
changeset
|
522 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
523 | newcaps = purple_protocol_get_media_caps(account, bname); |
|
29670
c1d3cb9db1d7
update prpl.c to use the new purple_buddy_[gs]et_media_caps api
Gary Kramlich <grim@reaperworld.com>
parents:
29653
diff
changeset
|
524 | purple_buddy_set_media_caps(buddy, newcaps); |
|
c1d3cb9db1d7
update prpl.c to use the new purple_buddy_[gs]et_media_caps api
Gary Kramlich <grim@reaperworld.com>
parents:
29653
diff
changeset
|
525 | |
|
c1d3cb9db1d7
update prpl.c to use the new purple_buddy_[gs]et_media_caps api
Gary Kramlich <grim@reaperworld.com>
parents:
29653
diff
changeset
|
526 | if (oldcaps == newcaps) |
|
29546
5858906c0f7b
Add media_caps to PurpleBuddy structure and use it to determine the old caps
Michael Ruprecht <maiku@pidgin.im>
parents:
29544
diff
changeset
|
527 | continue; |
|
29543
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
528 | |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
529 | purple_signal_emit(purple_blist_get_handle(), |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
530 | "buddy-caps-changed", buddy, |
|
29670
c1d3cb9db1d7
update prpl.c to use the new purple_buddy_[gs]et_media_caps api
Gary Kramlich <grim@reaperworld.com>
parents:
29653
diff
changeset
|
531 | newcaps, oldcaps); |
|
29543
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
532 | } |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
533 | #endif |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
534 | } |
|
4e38799c741e
Add the purple_media_got_media_caps function in order to signal when a prpl
Michael Ruprecht <maiku@pidgin.im>
parents:
27786
diff
changeset
|
535 | |
|
34327
a899fa8f95d5
Implement purple_prpl_get_max_message_size
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34146
diff
changeset
|
536 | gssize |
| 36701 | 537 | purple_protocol_get_max_message_size(PurpleProtocol *protocol) |
|
34327
a899fa8f95d5
Implement purple_prpl_get_max_message_size
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34146
diff
changeset
|
538 | { |
|
36844
b62140058cd3
Check for valid PurpleProtocols
Ankit Vani <a@nevitus.org>
parents:
36731
diff
changeset
|
539 | g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), 0); |
| 36701 | 540 | |
| 36719 | 541 | return purple_protocol_client_iface_get_max_message_size(protocol, NULL); |
| 36701 | 542 | } |
| 543 | ||
|
36624
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
544 | /************************************************************************** |
|
36375
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
545 | * Protocols API |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9460
diff
changeset
|
546 | **************************************************************************/ |
| 37084 | 547 | /* |
|
36658
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
548 | * Negative if a before b, 0 if equal, positive if a after b. |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
549 | */ |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
550 | static gint |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
551 | compare_protocol(PurpleProtocol *a, PurpleProtocol *b) |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
552 | { |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
553 | const gchar *aname = purple_protocol_get_name(a); |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
554 | const gchar *bname = purple_protocol_get_name(b); |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
555 | |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
556 | if (aname) { |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
557 | if (bname) |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
558 | return strcmp(aname, bname); |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
559 | else |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
560 | return -1; |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
561 | } else { |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
562 | if (bname) |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
563 | return 1; |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
564 | else |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
565 | return 0; |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
566 | } |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
567 | } |
|
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
568 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
569 | PurpleProtocol * |
|
36624
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
570 | purple_protocols_find(const char *id) |
|
36462
869de290ccfb
Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents:
36455
diff
changeset
|
571 | { |
| 36629 | 572 | g_return_val_if_fail(protocols != NULL && id != NULL, NULL); |
|
36624
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
573 | |
|
36462
869de290ccfb
Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents:
36455
diff
changeset
|
574 | return g_hash_table_lookup(protocols, id); |
|
869de290ccfb
Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents:
36455
diff
changeset
|
575 | } |
|
869de290ccfb
Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents:
36455
diff
changeset
|
576 | |
|
36571
89f3e5748a68
Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36559
diff
changeset
|
577 | PurpleProtocol * |
|
36627
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
578 | purple_protocols_add(GType protocol_type, GError **error) |
|
36462
869de290ccfb
Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents:
36455
diff
changeset
|
579 | { |
|
36612
4129d1ac5c1e
Check if a protocol type is valid before adding it
Ankit Vani <a@nevitus.org>
parents:
36608
diff
changeset
|
580 | PurpleProtocol *protocol; |
|
36723
d5014e354e8f
Refactored rest of libpurple to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
581 | PurpleProtocolClass *klass; |
|
36612
4129d1ac5c1e
Check if a protocol type is valid before adding it
Ankit Vani <a@nevitus.org>
parents:
36608
diff
changeset
|
582 | |
|
36698
c176dbc958f0
Made error handling better on protocol addition
Ankit Vani <a@nevitus.org>
parents:
36661
diff
changeset
|
583 | if (protocol_type == G_TYPE_INVALID) { |
|
39921
a9c92a82f4c8
Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39480
diff
changeset
|
584 | g_set_error_literal(error, PURPLE_PROTOCOLS_DOMAIN, 0, |
|
a9c92a82f4c8
Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39480
diff
changeset
|
585 | _("Protocol type is not registered")); |
|
36631
972b9fbb3690
Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents:
36629
diff
changeset
|
586 | return NULL; |
|
972b9fbb3690
Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents:
36629
diff
changeset
|
587 | } |
|
972b9fbb3690
Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents:
36629
diff
changeset
|
588 | |
|
36698
c176dbc958f0
Made error handling better on protocol addition
Ankit Vani <a@nevitus.org>
parents:
36661
diff
changeset
|
589 | if (!g_type_is_a(protocol_type, PURPLE_TYPE_PROTOCOL)) { |
|
39921
a9c92a82f4c8
Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39480
diff
changeset
|
590 | g_set_error_literal(error, PURPLE_PROTOCOLS_DOMAIN, 0, |
|
a9c92a82f4c8
Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39480
diff
changeset
|
591 | _("Protocol type does not inherit PurpleProtocol")); |
|
36698
c176dbc958f0
Made error handling better on protocol addition
Ankit Vani <a@nevitus.org>
parents:
36661
diff
changeset
|
592 | return NULL; |
|
c176dbc958f0
Made error handling better on protocol addition
Ankit Vani <a@nevitus.org>
parents:
36661
diff
changeset
|
593 | } |
|
c176dbc958f0
Made error handling better on protocol addition
Ankit Vani <a@nevitus.org>
parents:
36661
diff
changeset
|
594 | |
|
36713
8959b4ffee99
Added a protocol error check for abstract types
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
595 | if (G_TYPE_IS_ABSTRACT(protocol_type)) { |
|
39921
a9c92a82f4c8
Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39480
diff
changeset
|
596 | g_set_error_literal(error, PURPLE_PROTOCOLS_DOMAIN, 0, |
|
a9c92a82f4c8
Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39480
diff
changeset
|
597 | _("Protocol type is abstract")); |
|
36713
8959b4ffee99
Added a protocol error check for abstract types
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
598 | return NULL; |
|
8959b4ffee99
Added a protocol error check for abstract types
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
599 | } |
|
8959b4ffee99
Added a protocol error check for abstract types
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
600 | |
|
36698
c176dbc958f0
Made error handling better on protocol addition
Ankit Vani <a@nevitus.org>
parents:
36661
diff
changeset
|
601 | protocol = g_object_new(protocol_type, NULL); |
|
36713
8959b4ffee99
Added a protocol error check for abstract types
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
602 | if (!protocol) { |
|
39921
a9c92a82f4c8
Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39480
diff
changeset
|
603 | g_set_error_literal(error, PURPLE_PROTOCOLS_DOMAIN, 0, |
|
a9c92a82f4c8
Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39480
diff
changeset
|
604 | _("Could not create protocol instance")); |
|
36713
8959b4ffee99
Added a protocol error check for abstract types
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
605 | return NULL; |
|
8959b4ffee99
Added a protocol error check for abstract types
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
606 | } |
|
8959b4ffee99
Added a protocol error check for abstract types
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
607 | |
|
36627
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
608 | if (!purple_protocol_get_id(protocol)) { |
|
39921
a9c92a82f4c8
Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39480
diff
changeset
|
609 | g_set_error_literal(error, PURPLE_PROTOCOLS_DOMAIN, 0, |
|
a9c92a82f4c8
Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39480
diff
changeset
|
610 | _("Protocol does not provide an ID")); |
|
36627
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
611 | |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
612 | g_object_unref(protocol); |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
613 | return NULL; |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
614 | } |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
615 | |
|
36624
38043ecaf4a6
Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
616 | if (purple_protocols_find(purple_protocol_get_id(protocol))) { |
|
36627
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
617 | g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0, |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
618 | _("A protocol with the ID %s is already added."), |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
619 | purple_protocol_get_id(protocol)); |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
620 | |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
621 | g_object_unref(protocol); |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
622 | return NULL; |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
623 | } |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
624 | |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
625 | /* Make sure the protocol implements the required functions */ |
|
38200
324fe1dc33ac
Fix coverity 1297388
Gary Kramlich <grim@reaperworld.com>
parents:
37679
diff
changeset
|
626 | klass = PURPLE_PROTOCOL_GET_CLASS(protocol); |
|
324fe1dc33ac
Fix coverity 1297388
Gary Kramlich <grim@reaperworld.com>
parents:
37679
diff
changeset
|
627 | |
|
36731
38de3f22e864
Renamed close_connection back to close
Ankit Vani <a@nevitus.org>
parents:
36723
diff
changeset
|
628 | if (!klass->login || !klass->close || |
|
38de3f22e864
Renamed close_connection back to close
Ankit Vani <a@nevitus.org>
parents:
36723
diff
changeset
|
629 | !klass->status_types || !klass->list_icon ) |
|
36627
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
630 | { |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
631 | g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0, |
|
36723
d5014e354e8f
Refactored rest of libpurple to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
632 | _("Protocol %s does not implement all the functions in " |
|
d5014e354e8f
Refactored rest of libpurple to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
633 | "PurpleProtocolClass"), purple_protocol_get_id(protocol)); |
|
36627
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
634 | |
|
36571
89f3e5748a68
Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36559
diff
changeset
|
635 | g_object_unref(protocol); |
|
89f3e5748a68
Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36559
diff
changeset
|
636 | return NULL; |
|
89f3e5748a68
Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36559
diff
changeset
|
637 | } |
|
36462
869de290ccfb
Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents:
36455
diff
changeset
|
638 | |
|
36571
89f3e5748a68
Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36559
diff
changeset
|
639 | g_hash_table_insert(protocols, g_strdup(purple_protocol_get_id(protocol)), |
|
89f3e5748a68
Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36559
diff
changeset
|
640 | protocol); |
|
36661
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
641 | |
|
36852
73563f49084c
Added debug messages for protocol add and remove
Ankit Vani <a@nevitus.org>
parents:
36844
diff
changeset
|
642 | purple_debug_info("protocols", "Added protocol %s\n", |
|
73563f49084c
Added debug messages for protocol add and remove
Ankit Vani <a@nevitus.org>
parents:
36844
diff
changeset
|
643 | purple_protocol_get_id(protocol)); |
|
73563f49084c
Added debug messages for protocol add and remove
Ankit Vani <a@nevitus.org>
parents:
36844
diff
changeset
|
644 | |
|
36661
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
645 | purple_signal_emit(purple_protocols_get_handle(), "protocol-added", |
|
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
646 | protocol); |
|
36571
89f3e5748a68
Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36559
diff
changeset
|
647 | return protocol; |
|
36462
869de290ccfb
Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents:
36455
diff
changeset
|
648 | } |
|
869de290ccfb
Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents:
36455
diff
changeset
|
649 | |
|
36627
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
650 | gboolean purple_protocols_remove(PurpleProtocol *protocol, GError **error) |
|
36462
869de290ccfb
Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents:
36455
diff
changeset
|
651 | { |
|
36844
b62140058cd3
Check for valid PurpleProtocols
Ankit Vani <a@nevitus.org>
parents:
36731
diff
changeset
|
652 | g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), FALSE); |
|
36627
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
653 | g_return_val_if_fail(purple_protocol_get_id(protocol) != NULL, FALSE); |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
654 | |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
655 | if (purple_protocols_find(purple_protocol_get_id(protocol)) == NULL) { |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
656 | g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0, |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
657 | _("Protocol %s is not added."), |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
658 | purple_protocol_get_id(protocol)); |
|
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
659 | |
|
36462
869de290ccfb
Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents:
36455
diff
changeset
|
660 | return FALSE; |
|
36627
a3b0d16f69ef
Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents:
36624
diff
changeset
|
661 | } |
|
36455
27fb01531390
Destroy options, splits and actions when a protocol is removed
Ankit Vani <a@nevitus.org>
parents:
36396
diff
changeset
|
662 | |
|
36852
73563f49084c
Added debug messages for protocol add and remove
Ankit Vani <a@nevitus.org>
parents:
36844
diff
changeset
|
663 | purple_debug_info("protocols", "Removing protocol %s\n", |
|
73563f49084c
Added debug messages for protocol add and remove
Ankit Vani <a@nevitus.org>
parents:
36844
diff
changeset
|
664 | purple_protocol_get_id(protocol)); |
|
73563f49084c
Added debug messages for protocol add and remove
Ankit Vani <a@nevitus.org>
parents:
36844
diff
changeset
|
665 | |
|
36661
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
666 | purple_signal_emit(purple_protocols_get_handle(), "protocol-removed", |
|
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
667 | protocol); |
|
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
668 | |
|
36571
89f3e5748a68
Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36559
diff
changeset
|
669 | g_hash_table_remove(protocols, purple_protocol_get_id(protocol)); |
|
36375
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
670 | return TRUE; |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
671 | } |
|
10036
743f585a1141
[gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents:
10023
diff
changeset
|
672 | |
|
36378
d51a8507f4e0
Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36375
diff
changeset
|
673 | GList * |
|
d51a8507f4e0
Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36375
diff
changeset
|
674 | purple_protocols_get_all(void) |
|
d51a8507f4e0
Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36375
diff
changeset
|
675 | { |
|
d51a8507f4e0
Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36375
diff
changeset
|
676 | GList *ret = NULL; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
677 | PurpleProtocol *protocol; |
|
36378
d51a8507f4e0
Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36375
diff
changeset
|
678 | GHashTableIter iter; |
|
d51a8507f4e0
Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36375
diff
changeset
|
679 | |
|
d51a8507f4e0
Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36375
diff
changeset
|
680 | g_hash_table_iter_init(&iter, protocols); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
681 | while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&protocol)) |
|
36658
85008f2cf762
Return protocols as a sorted list from purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
682 | ret = g_list_insert_sorted(ret, protocol, (GCompareFunc)compare_protocol); |
|
36378
d51a8507f4e0
Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36375
diff
changeset
|
683 | |
|
d51a8507f4e0
Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36375
diff
changeset
|
684 | return ret; |
|
d51a8507f4e0
Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36375
diff
changeset
|
685 | } |
|
d51a8507f4e0
Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36375
diff
changeset
|
686 | |
|
36375
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
687 | /************************************************************************** |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
688 | * Protocols Subsystem API |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
689 | **************************************************************************/ |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
690 | void |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
691 | purple_protocols_init(void) |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
692 | { |
|
36661
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
693 | void *handle = purple_protocols_get_handle(); |
|
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
694 | |
| 36465 | 695 | protocols = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
|
40128
9b64a2d80f8c
Remove redundant callback type casts
qarkai <qarkai@gmail.com>
parents:
39970
diff
changeset
|
696 | g_object_unref); |
|
36661
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
697 | |
|
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
698 | purple_signal_register(handle, "protocol-added", |
|
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
699 | purple_marshal_VOID__POINTER, |
|
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
700 | G_TYPE_NONE, 1, PURPLE_TYPE_PROTOCOL); |
|
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
701 | purple_signal_register(handle, "protocol-removed", |
|
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
702 | purple_marshal_VOID__POINTER, |
|
908a67a0072a
Added signals "protocol-added" and "protocol-removed"
Ankit Vani <a@nevitus.org>
parents:
36658
diff
changeset
|
703 | G_TYPE_NONE, 1, PURPLE_TYPE_PROTOCOL); |
|
36375
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
704 | } |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
705 | |
|
36375
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
706 | void * |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
707 | purple_protocols_get_handle(void) |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
708 | { |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
709 | static int handle; |
| 981 | 710 | |
|
36375
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
711 | return &handle; |
| 981 | 712 | } |
|
36375
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
713 | |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
714 | void |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
715 | purple_protocols_uninit(void) |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
716 | { |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
717 | g_hash_table_destroy(protocols); |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
718 | } |
|
8ed701a7333e
Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
719 |