libpurple/protocols.c

Tue, 24 Oct 2023 01:04:19 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Tue, 24 Oct 2023 01:04:19 -0500
changeset 42388
e0f4a672f85d
parent 42071
a719f0f3c600
child 42557
e868bfcc092a
permissions
-rw-r--r--

Add symbol visibility for symbols tagged with Since: 2.x

These are _only_ symbols that already have `Since: 2.x.y`.

Testing Done:
Compiled, mostly.

Bugs closed: PIDGIN-17838

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

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 "debug.h"
24519
d4af3d043211 Improve our NetworkManager support in a couple of ways:
Richard Laager <rlaager@pidgin.im>
parents: 23875
diff changeset
27 #include "network.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
28 #include "notify.h"
39970
cc7d4ff5a205 rename accountopt.[ch] to purpleaccountoption.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39921
diff changeset
29 #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
30 #include "purpleconversation.h"
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
31 #include "purpleconversationmanager.h"
40680
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
32 #include "purplecredentialmanager.h"
41155
922c9e70900c Rename protocol.[ch] to purpleprotocol.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41137
diff changeset
33 #include "purpleprotocol.h"
40735
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
34 #include "purpleprotocolmanager.h"
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
35 #include "purpleprotocolmedia.h"
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40680
diff changeset
36 #include "purpleprotocolserver.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
37 #include "request.h"
41137
3c1574216aed Now that the History API is here, remove the purple logging api
Gary Kramlich <grim@reaperworld.com>
parents: 40992
diff changeset
38 #include "server.h"
5872
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
22225
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
41 /**************************************************************************/
37075
cf3f735b09b7 Merge gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 35472 36868
diff changeset
42 /* Protocol API */
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
43 /**************************************************************************/
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
44 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
45 purple_protocol_got_user_idle(PurpleAccount *account, const char *name,
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
46 gboolean idle, time_t idle_time)
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
47 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
48 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
49 GSList *list;
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42009
diff changeset
50 GDateTime *idle_date_time = NULL;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
51
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
52 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
53 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
54 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
55
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
56 if ((list = purple_blist_find_buddies(account, name)) == NULL)
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
57 return;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
58
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42009
diff changeset
59 idle_date_time = g_date_time_new_from_unix_local(idle_time);
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
60 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
61 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
62 list = g_slist_delete_link(list, list);
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42009
diff changeset
63 purple_presence_set_idle(presence, idle, idle_date_time);
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
64 }
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42009
diff changeset
65 g_date_time_unref(idle_date_time);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
66 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
67
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
68 void
41781
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
69 purple_protocol_got_user_status_with_attributes(PurpleAccount *account,
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
70 const gchar *name,
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
71 const gchar *status_id,
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
72 GHashTable *attributes)
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
73 {
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
74 GSList *list, *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
75 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
76 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
77 PurpleStatus *status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
78 PurpleStatus *old_status;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
79
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
80 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
81 g_return_if_fail(name != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
82 g_return_if_fail(status_id != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
83 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
84
41781
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
85 if((list = purple_blist_find_buddies(account, name)) == NULL) {
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
86 return;
41781
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
87 }
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
88
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
89 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
90 buddy = l->data;
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
91
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
92 presence = purple_buddy_get_presence(buddy);
41781
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
93 status = purple_presence_get_status(presence, status_id);
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
94
41781
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
95 if(NULL == status) {
27786
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
96 /*
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
97 * TODO: This should never happen, right? We should call
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
98 * g_warning() or something.
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
99 */
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
100 continue;
41781
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
101 }
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
102
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
103 old_status = purple_presence_get_active_status(presence);
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
104
41782
5fb843f4e356 Merge purple_status_set_active_with_attrs{,_dict}
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41781
diff changeset
105 purple_status_set_active_with_attributes(status, TRUE, attributes);
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
106
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
107 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
108 }
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
109
12126
3b70215e9630 [gaim-migrate @ 14426]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12108
diff changeset
110 g_slist_free(list);
12654
2e25e75190c4 [gaim-migrate @ 14997]
Mark Doliner <markdoliner@pidgin.im>
parents: 12377
diff changeset
111
27596
bc7058e10c04 Make the comment reflect that we are actually just stopping the typing
Etan Reisner <deryni@pidgin.im>
parents: 26871
diff changeset
112 /* 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
113 * 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
114 if (!purple_status_is_online(status)) {
35501
602747bb4af9 Fix duplicate prefixes
Ankit Vani <a@nevitus.org>
parents: 35499
diff changeset
115 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
116 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
117 }
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
41781
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
120 void
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
121 purple_protocol_got_user_status(PurpleAccount *account, const gchar *name,
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
122 const gchar *status_id, ...)
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
123 {
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
124 GHashTable *attributes = NULL;
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
125 va_list args;
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
126
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
127 va_start(args, status_id);
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
128 attributes = purple_attrs_from_vargs(args);
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
129 va_end(args);
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
130
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
131 purple_protocol_got_user_status_with_attributes(account, name, status_id,
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
132 attributes);
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
133
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
134 g_hash_table_destroy(attributes);
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
135 }
5891e14ae316 Add introspectable versions of purple_protocol_got_{account,user}_status
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41685
diff changeset
136
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
137 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
138 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
139 {
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
140 GSList *list, *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
141 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
142 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
143 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
144
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
145 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
146 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
147 g_return_if_fail(status_id != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
148 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
149
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
150 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
151 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
152
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
153 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
154 buddy = l->data;
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
155
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
156 presence = purple_buddy_get_presence(buddy);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
157 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
158
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
159 if(NULL == status)
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
160 continue;
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
161
19692
06e6aba21930 Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19654
diff changeset
162 if (purple_status_is_active(status)) {
06e6aba21930 Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19654
diff changeset
163 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
164 purple_buddy_update_status(buddy, status);
19692
06e6aba21930 Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19654
diff changeset
165 }
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
166 }
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
167
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
168 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
169 }
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
170
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
171 static void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
172 do_protocol_change_account_status(PurpleAccount *account,
41960
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41919
diff changeset
173 G_GNUC_UNUSED PurpleStatus *old_status,
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41919
diff changeset
174 PurpleStatus *new_status)
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
175 {
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
176 PurpleProtocol *protocol;
40735
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
177 PurpleProtocolManager *manager;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
178
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
179 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
180 purple_account_is_disconnected(account) &&
d4af3d043211 Improve our NetworkManager support in a couple of ways:
Richard Laager <rlaager@pidgin.im>
parents: 23875
diff changeset
181 purple_network_is_available())
11718
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
182 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
183 purple_account_connect(account);
11718
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
184 return;
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
185 }
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
186
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
187 if (!purple_status_is_online(new_status))
14224
d6d41ff969df [gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14097
diff changeset
188 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
189 if (!purple_account_is_disconnected(account))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
190 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
191 /* 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
192 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
193 PurpleCredentialManager *manager = NULL;
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
194
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
195 manager = purple_credential_manager_get_default();
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
196
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
197 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
198 NULL, NULL, NULL);
f9ea6d5e8992 Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
199 }
34019
bc87f596bb4c compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents: 34018
diff changeset
200
14224
d6d41ff969df [gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14097
diff changeset
201 return;
d6d41ff969df [gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14097
diff changeset
202 }
11718
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
203
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
204 if (purple_account_is_connecting(account))
12108
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
205 /*
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36631
diff changeset
206 * 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
207 * 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
208 * connection process.
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
209 */
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
210 return;
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
211
40735
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
212 manager = purple_protocol_manager_get_default();
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
213 protocol = purple_protocol_manager_find(manager,
cc0679f47fd9 Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
214 purple_account_get_protocol_id(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
215
41282
c47df057a426 Silence warning from changing status of the demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41176
diff changeset
216 if (!PURPLE_IS_PROTOCOL_SERVER(protocol)) {
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
217 return;
41282
c47df057a426 Silence warning from changing status of the demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41176
diff changeset
218 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
219
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40680
diff changeset
220 if(!purple_account_is_disconnected(account)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40680
diff changeset
221 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
222 account, new_status);
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40680
diff changeset
223 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
224 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
225
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
226 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
227 purple_protocol_change_account_status(PurpleAccount *account,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
228 PurpleStatus *old_status, PurpleStatus *new_status)
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
229 {
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
230 g_return_if_fail(account != NULL);
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
231 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
232 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
233
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
234 do_protocol_change_account_status(account, old_status, new_status);
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
235
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
236 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
237 account, old_status, new_status);
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
238 }
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
239
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
240 GList *
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
241 purple_protocol_get_statuses(PurpleAccount *account, PurplePresence *presence)
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
242 {
10447
887380ec66f5 [gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents: 10052
diff changeset
243 g_return_val_if_fail(account != NULL, NULL);
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
244 g_return_val_if_fail(presence != NULL, NULL);
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
245
40783
4f197d3e42d6 Use g_list_copy_deep instead of manual copy/transform
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40735
diff changeset
246 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
247 (GCopyFunc)purple_status_new, presence);
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
248 }
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
249
26495
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26482
diff changeset
250 gboolean
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
251 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
252 const char *who,
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26107
diff changeset
253 PurpleMediaSessionType type)
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
254 {
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
255 PurpleConnection *gc = NULL;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
256 PurpleProtocol *protocol = NULL;
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
257
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
258 if(account) {
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
259 gc = purple_account_get_connection(account);
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
260 }
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
261 if(gc) {
36623
caaadef03507 Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents: 36620
diff changeset
262 protocol = purple_connection_get_protocol(gc);
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
263 }
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
264
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
265 if(PURPLE_IS_PROTOCOL_MEDIA(protocol)) {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
266 PurpleProtocolMedia *media = PURPLE_PROTOCOL_MEDIA(protocol);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
267
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
268 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
269 type);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
270 } else {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
271 return FALSE;
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
272 }
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
273 }
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
274
26316
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26260
diff changeset
275 PurpleMediaCaps
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
276 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
277 {
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
278 PurpleConnection *gc = NULL;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
279 PurpleProtocol *protocol = NULL;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
280
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
281 if(account) {
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
282 gc = purple_account_get_connection(account);
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
283 }
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
284 if(gc) {
36623
caaadef03507 Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents: 36620
diff changeset
285 protocol = purple_connection_get_protocol(gc);
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
286 }
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
287
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
288 if(PURPLE_IS_PROTOCOL_MEDIA(protocol)) {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
289 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
290 account, who);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
291 } else {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
292 return PURPLE_MEDIA_CAPS_NONE;
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
293 }
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
294 }
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
295
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
296 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
297 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
298 {
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
299 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
300
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
301 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
302 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
303
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
304 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
305 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
306
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
307 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
308 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
309 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
310 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
311 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
312 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
313
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
314
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
315 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
316 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
317
c1d3cb9db1d7 update prpl.c to use the new purple_buddy_[gs]et_media_caps api
Gary Kramlich <grim@reaperworld.com>
parents: 29653
diff changeset
318 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
319 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
320
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
321 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
322 "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
323 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
324 }
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
325 }

mercurial