libpurple/protocols.c

Mon, 12 Apr 2021 20:27:47 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 12 Apr 2021 20:27:47 -0500
changeset 40853
d3518ff99fa7
parent 40807
b41d37dbf129
child 40885
87f6241da196
permissions
-rw-r--r--

rename conversation.[ch] to purpleconversation.[ch] and split PurpleConversationUiOps out to its own file to avoid circular include issues.

Testing Done:
Compiled and ran locally including docs and pot file. The pot file fails as I need to rebase on [596](https://reviews.imfreedom.org/r/596/)

Reviewed at https://reviews.imfreedom.org/r/597/

981
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1 /*
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
2 * purple
981
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
8046
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7956
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7956
diff changeset
6 * source distribution.
6460
fc288e7221ca [gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
7 *
981
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
11 * (at your option) any later version.
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
12 *
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
16 * GNU General Public License for more details.
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
17 *
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
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
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
21 *
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
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"
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
27 #include "debug.h"
24519
d4af3d043211 Improve our NetworkManager support in a couple of ways:
Richard Laager <rlaager@pidgin.im>
parents: 23875
diff changeset
28 #include "network.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
29 #include "notify.h"
36543
a8c3fecee2d3 Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents: 36537
diff changeset
30 #include "protocol.h"
39970
cc7d4ff5a205 rename accountopt.[ch] to purpleaccountoption.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39921
diff changeset
31 #include "purpleaccountoption.h"
40853
d3518ff99fa7 rename conversation.[ch] to purpleconversation.[ch] and split PurpleConversationUiOps out to its own file to avoid circular include issues.
Gary Kramlich <grim@reaperworld.com>
parents: 40807
diff changeset
32 #include "purpleconversation.h"
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
33 #include "purplecredentialmanager.h"
40579
882884b9bc97 Split PurpleAttentionType and PurpleProtocolAttention into their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40525
diff changeset
34 #include "purpleprotocolattention.h"
40735
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
35 #include "purpleprotocolmanager.h"
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
36 #include "purpleprotocolmedia.h"
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40680
diff changeset
37 #include "purpleprotocolserver.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
38 #include "request.h"
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
39 #include "util.h"
3738
1dea426a205b [gaim-migrate @ 3876]
Rob Flynn <gaim@robflynn.com>
parents: 3733
diff changeset
40
36624
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 * GBoxed code for PurpleProtocolChatEntry
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
43 **************************************************************************/
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 static PurpleProtocolChatEntry *
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
46 purple_protocol_chat_entry_copy(PurpleProtocolChatEntry *pce)
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
47 {
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
48 PurpleProtocolChatEntry *pce_copy;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
49
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
50 g_return_val_if_fail(pce != NULL, NULL);
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 pce_copy = g_new(PurpleProtocolChatEntry, 1);
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
53 *pce_copy = *pce;
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 return pce_copy;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
56 }
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 GType
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
59 purple_protocol_chat_entry_get_type(void)
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
60 {
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
61 static GType type = 0;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
62
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
63 if (type == 0) {
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
64 type = g_boxed_type_register_static("PurpleProtocolChatEntry",
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
65 (GBoxedCopyFunc)purple_protocol_chat_entry_copy,
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
66 (GBoxedFreeFunc)g_free);
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
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
69 return type;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
70 }
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
71
22225
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
72 /**************************************************************************/
37075
cf3f735b09b7 Merge gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 35472 36868
diff changeset
73 /* Protocol API */
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
74 /**************************************************************************/
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
75 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
76 purple_protocol_got_account_idle(PurpleAccount *account, gboolean idle,
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
77 time_t idle_time)
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
78 {
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
79 g_return_if_fail(account != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
80 g_return_if_fail(purple_account_is_connected(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
81
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
82 purple_presence_set_idle(purple_account_get_presence(account),
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
83 idle, idle_time);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
84 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
85
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
86 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
87 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
88 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
89 PurplePresence *presence;
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 g_return_if_fail(account != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
92 g_return_if_fail(purple_account_is_connected(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
93
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
94 if (login_time == 0)
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
95 login_time = time(NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
96
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
97 presence = purple_account_get_presence(account);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
98
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
99 purple_presence_set_login_time(presence, login_time);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
100 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
101
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
102 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
103 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
104 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
105 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
106 PurpleStatus *status;
13374
e5da5325b1fa [gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13335
diff changeset
107 va_list args;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
108
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
109 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
110 g_return_if_fail(status_id != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
111 g_return_if_fail(purple_account_is_connected(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
112
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
113 presence = purple_account_get_presence(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
114 status = purple_presence_get_status(presence, status_id);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
115
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
116 g_return_if_fail(status != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
117
13374
e5da5325b1fa [gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13335
diff changeset
118 va_start(args, status_id);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
119 purple_status_set_active_with_attrs(status, TRUE, args);
13374
e5da5325b1fa [gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13335
diff changeset
120 va_end(args);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
121 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
122
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
123 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
124 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
125 {
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
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
127 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
128 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
129
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
130 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
131 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
132 }
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
133
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
134 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
135 purple_protocol_got_user_idle(PurpleAccount *account, const char *name,
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
136 gboolean idle, time_t idle_time)
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
137 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
138 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
139 GSList *list;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
140
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
141 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
142 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
143 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
144
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
145 if ((list = purple_blist_find_buddies(account, name)) == NULL)
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
146 return;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
147
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
148 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
149 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
150 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
151 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
152 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
153 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
154
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
155 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
156 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
157 time_t login_time)
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
158 {
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
159 GSList *list;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
160 PurplePresence *presence;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
161
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
162 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
163 g_return_if_fail(name != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
164
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
165 if ((list = purple_blist_find_buddies(account, name)) == NULL)
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
166 return;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
167
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
168 if (login_time == 0)
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
169 login_time = time(NULL);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
170
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
171 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
172 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
173 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
174 list = g_slist_delete_link(list, list);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
175
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
176 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
177 {
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 purple_presence_set_login_time(presence, login_time);
15212
2919bfea7c4a [gaim-migrate @ 17936]
Evan Schoenberg <evands@pidgin.im>
parents: 14254
diff changeset
179
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
180 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
181 }
15311
f5cf28c6e665 [gaim-migrate @ 18039]
Evan Schoenberg <evands@pidgin.im>
parents: 15212
diff changeset
182 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
183 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
184
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
185 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
186 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
187 const char *status_id, ...)
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
188 {
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
189 GSList *list, *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
190 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
191 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
192 PurpleStatus *status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
193 PurpleStatus *old_status;
13374
e5da5325b1fa [gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13335
diff changeset
194 va_list args;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
195
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
196 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
197 g_return_if_fail(name != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
198 g_return_if_fail(status_id != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
199 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
200
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
201 if((list = purple_blist_find_buddies(account, name)) == NULL)
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
202 return;
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 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
205 buddy = l->data;
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 presence = purple_buddy_get_presence(buddy);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
208 status = purple_presence_get_status(presence, status_id);
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
209
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
210 if(NULL == status)
27786
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
211 /*
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
212 * TODO: This should never happen, right? We should call
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
213 * g_warning() or something.
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
214 */
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
215 continue;
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
216
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
217 old_status = purple_presence_get_active_status(presence);
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
218
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
219 va_start(args, status_id);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
220 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
221 va_end(args);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
222
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
223 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
224 }
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
225
12126
3b70215e9630 [gaim-migrate @ 14426]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12108
diff changeset
226 g_slist_free(list);
12654
2e25e75190c4 [gaim-migrate @ 14997]
Mark Doliner <markdoliner@pidgin.im>
parents: 12377
diff changeset
227
27596
bc7058e10c04 Make the comment reflect that we are actually just stopping the typing
Etan Reisner <deryni@pidgin.im>
parents: 26871
diff changeset
228 /* 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
229 * 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
230 if (!purple_status_is_online(status)) {
35501
602747bb4af9 Fix duplicate prefixes
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
231 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
232 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
233 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
234 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
235
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
236 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
237 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
238 {
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
239 GSList *list, *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
240 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
241 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
242 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
243
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
244 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
245 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
246 g_return_if_fail(status_id != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
247 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
248
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
249 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
250 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
251
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
252 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
253 buddy = l->data;
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
254
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
255 presence = purple_buddy_get_presence(buddy);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
256 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
257
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
258 if(NULL == status)
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
259 continue;
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
260
19692
06e6aba21930 Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19654
diff changeset
261 if (purple_status_is_active(status)) {
06e6aba21930 Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19654
diff changeset
262 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
263 purple_buddy_update_status(buddy, status);
19692
06e6aba21930 Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19654
diff changeset
264 }
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
265 }
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
266
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
267 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
268 }
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
269
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
270 static void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
271 do_protocol_change_account_status(PurpleAccount *account,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
272 PurpleStatus *old_status, PurpleStatus *new_status)
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
273 {
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
274 PurpleProtocol *protocol;
40735
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
275 PurpleProtocolManager *manager;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
276
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
277 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
278 purple_account_is_disconnected(account) &&
d4af3d043211 Improve our NetworkManager support in a couple of ways:
Richard Laager <rlaager@pidgin.im>
parents: 23875
diff changeset
279 purple_network_is_available())
11718
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
280 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
281 purple_account_connect(account);
11718
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
282 return;
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
283 }
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
284
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
285 if (!purple_status_is_online(new_status))
14224
d6d41ff969df [gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14097
diff changeset
286 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
287 if (!purple_account_is_disconnected(account))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
288 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
289 /* Clear out the unsaved password if we switch to offline status */
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
290 if (!purple_account_get_remember_password(account)) {
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
291 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
292
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
293 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
294
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
295 purple_credential_manager_clear_password_async(manager, account,
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
296 NULL, NULL, NULL);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
297 }
34019
bc87f596bb4c compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents: 34018
diff changeset
298
14224
d6d41ff969df [gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14097
diff changeset
299 return;
d6d41ff969df [gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14097
diff changeset
300 }
11718
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
301
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
302 if (purple_account_is_connecting(account))
12108
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
303 /*
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36631
diff changeset
304 * 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
305 * 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
306 * connection process.
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
307 */
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
308 return;
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
309
40735
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
310 manager = purple_protocol_manager_get_default();
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
311 protocol = purple_protocol_manager_find(manager,
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
312 purple_account_get_protocol_id(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
313
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
314 if (protocol == NULL)
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
315 return;
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
316
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40680
diff changeset
317 if(!purple_account_is_disconnected(account)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40680
diff changeset
318 purple_protocol_server_set_status(PURPLE_PROTOCOL_SERVER(protocol),
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40680
diff changeset
319 account, new_status);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40680
diff changeset
320 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
321 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
322
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
323 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
324 purple_protocol_change_account_status(PurpleAccount *account,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
325 PurpleStatus *old_status, PurpleStatus *new_status)
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
326 {
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
327 g_return_if_fail(account != NULL);
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
328 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
329 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
330
37679
6ff708c38c04 Add "account-status-changing" signal from instantbird
Florian Quèze <florian@instantbird.org>
parents: 37148
diff changeset
331 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
332 account, old_status, new_status);
6ff708c38c04 Add "account-status-changing" signal from instantbird
Florian Quèze <florian@instantbird.org>
parents: 37148
diff changeset
333
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
334 do_protocol_change_account_status(account, old_status, new_status);
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
335
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
336 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
337 account, old_status, new_status);
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
338 }
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
339
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
340 GList *
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
341 purple_protocol_get_statuses(PurpleAccount *account, PurplePresence *presence)
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
342 {
10447
887380ec66f5 [gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents: 10052
diff changeset
343 g_return_val_if_fail(account != NULL, NULL);
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
344 g_return_val_if_fail(presence != NULL, NULL);
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
345
40783
4f197d3e42d6 Use g_list_copy_deep instead of manual copy/transform
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40735
diff changeset
346 return g_list_copy_deep(purple_account_get_status_types(account),
4f197d3e42d6 Use g_list_copy_deep instead of manual copy/transform
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40735
diff changeset
347 (GCopyFunc)purple_status_new, presence);
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
348 }
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
349
29487
1fa2077fb506 Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents: 29486
diff changeset
350 static void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
351 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
352 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
353 {
1fa2077fb506 Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents: 29486
diff changeset
354 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
355 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
356 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
357 account, who, conv, type);
1fa2077fb506 Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents: 29486
diff changeset
358 }
1fa2077fb506 Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents: 29486
diff changeset
359
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
360 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
361 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
362 {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
363 PurpleAttentionType *attn;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
364 PurpleProtocol *protocol;
40735
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
365 PurpleProtocolManager *manager;
34656
adbcbe04077c Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34627
diff changeset
366 PurpleIMConversation *im;
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
367 PurpleBuddy *buddy;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25869
diff changeset
368 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
369 gchar *description;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
370
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
371 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
372 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
373
40735
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
374 manager = purple_protocol_manager_get_default();
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
375 protocol = purple_protocol_manager_find(manager,
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
376 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
377 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
378
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32554
diff changeset
379 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
380
40579
882884b9bc97 Split PurpleAttentionType and PurpleProtocolAttention into their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40525
diff changeset
381 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
382 alias = purple_buddy_get_contact_alias(buddy);
40579
882884b9bc97 Split PurpleAttentionType and PurpleProtocolAttention into their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40525
diff changeset
383 } else {
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
384 alias = who;
40579
882884b9bc97 Split PurpleAttentionType and PurpleProtocolAttention into their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40525
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
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
387 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
388 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
389 } else {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
390 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
391 }
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25869
diff changeset
392
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
393 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
394 description, who);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
395
40579
882884b9bc97 Split PurpleAttentionType and PurpleProtocolAttention into their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40525
diff changeset
396 if (!purple_protocol_attention_send_attention(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
397 return;
40579
882884b9bc97 Split PurpleAttentionType and PurpleProtocolAttention into their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40525
diff changeset
398 }
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
399
34656
adbcbe04077c Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34627
diff changeset
400 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
401 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
402 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
403
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
404 g_free(description);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
405 }
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
406
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
407 static void
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
408 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
409 {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
410 PurpleMessageFlags flags;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
411 PurpleAttentionType *attn;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
412 PurpleBuddy *buddy;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
413 const char *alias;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
414 gchar *description;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
415 time_t mtime;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
416
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
417 mtime = time(NULL);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
418
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32554
diff changeset
419 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
420
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
421 /* 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
422 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
423
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
424 /* 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
425 * 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
426
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
427 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
428 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
429 else
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
430 alias = who;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
431
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
432 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
433 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
434 } else {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
435 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
436 }
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 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
439 description, who);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
440
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
441 if (id == -1)
35499
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 35472
diff changeset
442 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
443 else
35499
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 35472
diff changeset
444 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
445
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
446 /* 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
447
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
448 g_free(description);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
449 }
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
450
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
451 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
452 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
453 {
29485
ee00ab964bcb Let _got_attention call _conversation_attention, instead of having prpls do it
Marcus Lundblad <malu@pidgin.im>
parents: 29483
diff changeset
454 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
455 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
456
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
457 got_attention(gc, -1, who, type_code);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
458 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
459 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
460 if (conv)
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
461 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
462 time(NULL));
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
463 }
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
464
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
465 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
466 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
467 {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
468 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
469 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
470
26495
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26482
diff changeset
471 gboolean
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
472 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
473 const char *who,
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26107
diff changeset
474 PurpleMediaSessionType type)
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
475 {
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
476 #ifdef USE_VV
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
477 PurpleConnection *gc = NULL;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
478 PurpleProtocol *protocol = NULL;
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
479
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
480 if(account) {
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
481 gc = purple_account_get_connection(account);
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
482 }
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
483 if(gc) {
36623
caaadef03507 Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents: 36620
diff changeset
484 protocol = purple_connection_get_protocol(gc);
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
485 }
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
486
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
487 if(PURPLE_IS_PROTOCOL_MEDIA(protocol)) {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
488 PurpleProtocolMedia *media = PURPLE_PROTOCOL_MEDIA(protocol);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
489
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
490 return purple_protocol_media_initiate_session(media, account, who,
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
491 type);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
492 } else {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
493 return FALSE;
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
494 }
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
495 #else
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
496 return FALSE;
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
497 #endif
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
498 }
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
499
26316
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26260
diff changeset
500 PurpleMediaCaps
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
501 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
502 {
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
503 #ifdef USE_VV
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
504 PurpleConnection *gc = NULL;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
505 PurpleProtocol *protocol = NULL;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
506
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
507 if(account) {
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
508 gc = purple_account_get_connection(account);
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
509 }
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
510 if(gc) {
36623
caaadef03507 Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents: 36620
diff changeset
511 protocol = purple_connection_get_protocol(gc);
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
512 }
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
513
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
514 if(PURPLE_IS_PROTOCOL_MEDIA(protocol)) {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
515 return purple_protocol_media_get_caps(PURPLE_PROTOCOL_MEDIA(protocol),
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
516 account, who);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
517 } else {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
518 return PURPLE_MEDIA_CAPS_NONE;
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
519 }
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
520 #else
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
521 return PURPLE_MEDIA_CAPS_NONE;
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
522 #endif
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
523 }
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
524
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
525 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
526 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
527 {
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 #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
529 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
530
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
531 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
532 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
533
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
534 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
535 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
536
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
537 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
538 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
539 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
540 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
541 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
542 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
543
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
544
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
545 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
546 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
547
c1d3cb9db1d7 update prpl.c to use the new purple_buddy_[gs]et_media_caps api
Gary Kramlich <grim@reaperworld.com>
parents: 29653
diff changeset
548 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
549 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
550
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
551 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
552 "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
553 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
554 }
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
555 #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
556 }
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
557

mercurial