libpurple/protocols.c

Sat, 31 Aug 2013 22:26:34 +0530

author
Ankit Vani <a@nevitus.org>
date
Sat, 31 Aug 2013 22:26:34 +0530
branch
soc.2013.gobjectification.plugins
changeset 36620
c76013b145f4
parent 36619
bade26478caa
child 36623
caaadef03507
permissions
-rw-r--r--

Added PURPLE_PROTOCOL_IMPLEMENTS(protocol,func) to check if a protocol implements a function

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 */
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
23 #include "internal.h"
36455
27fb01531390 Destroy options, splits and actions when a protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36396
diff changeset
24 #include "accountopt.h"
5945
941f14d90d22 [gaim-migrate @ 6386]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
25 #include "conversation.h"
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"
36543
a8c3fecee2d3 Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents: 36537
diff changeset
29 #include "protocol.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
30 #include "request.h"
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
31 #include "util.h"
3738
1dea426a205b [gaim-migrate @ 3876]
Rob Flynn <gaim@robflynn.com>
parents: 3733
diff changeset
32
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
33 static GHashTable *protocols = NULL;
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
34
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
35 /**************************************************************************/
22225
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
36 /** @name Attention Type API */
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
37 /**************************************************************************/
32302
8d7ae15354e1 Hide PurpleAttentionType struct and remove attention @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
38
8d7ae15354e1 Hide PurpleAttentionType struct and remove attention @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
39 struct _PurpleAttentionType
8d7ae15354e1 Hide PurpleAttentionType struct and remove attention @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
40 {
8d7ae15354e1 Hide PurpleAttentionType struct and remove attention @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
41 const char *name; /**< Shown in GUI elements */
8d7ae15354e1 Hide PurpleAttentionType struct and remove attention @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
42 const char *incoming_description; /**< Shown when sent */
8d7ae15354e1 Hide PurpleAttentionType struct and remove attention @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
43 const char *outgoing_description; /**< Shown when receied */
8d7ae15354e1 Hide PurpleAttentionType struct and remove attention @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
44 const char *icon_name; /**< Icon to display (optional) */
8d7ae15354e1 Hide PurpleAttentionType struct and remove attention @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
45 const char *unlocalized_name; /**< Unlocalized name for UIs needing it */
8d7ae15354e1 Hide PurpleAttentionType struct and remove attention @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
46 };
8d7ae15354e1 Hide PurpleAttentionType struct and remove attention @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
47
8d7ae15354e1 Hide PurpleAttentionType struct and remove attention @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
48
22225
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
49 PurpleAttentionType *
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
50 purple_attention_type_new(const char *ulname, const char *name,
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
51 const char *inc_desc, const char *out_desc)
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
52 {
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
53 PurpleAttentionType *attn = g_new0(PurpleAttentionType, 1);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
54
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
55 purple_attention_type_set_name(attn, name);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
56 purple_attention_type_set_incoming_desc(attn, inc_desc);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
57 purple_attention_type_set_outgoing_desc(attn, out_desc);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
58 purple_attention_type_set_unlocalized_name(attn, ulname);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
59
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
60 return attn;
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
61 }
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
62
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
63
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
64 void
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
65 purple_attention_type_set_name(PurpleAttentionType *type, const char *name)
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
66 {
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
67 g_return_if_fail(type != NULL);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
68
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
69 type->name = name;
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
70 }
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
71
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
72 void
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
73 purple_attention_type_set_incoming_desc(PurpleAttentionType *type, const char *desc)
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
74 {
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
75 g_return_if_fail(type != NULL);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
76
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
77 type->incoming_description = desc;
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
78 }
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
79
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
80 void
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
81 purple_attention_type_set_outgoing_desc(PurpleAttentionType *type, const char *desc)
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
82 {
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
83 g_return_if_fail(type != NULL);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
84
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
85 type->outgoing_description = desc;
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
86 }
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
87
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
88 void
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
89 purple_attention_type_set_icon_name(PurpleAttentionType *type, const char *name)
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
90 {
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
91 g_return_if_fail(type != NULL);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25869
diff changeset
92
22225
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
93 type->icon_name = name;
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
94 }
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
95
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
96 void
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
97 purple_attention_type_set_unlocalized_name(PurpleAttentionType *type, const char *ulname)
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
98 {
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
99 g_return_if_fail(type != NULL);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
100
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
101 type->unlocalized_name = ulname;
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
102 }
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
103
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
104 const char *
22251
a7c65a128467 const-ify paramteters to some of the new API I added. I thought I did this already.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22225
diff changeset
105 purple_attention_type_get_name(const PurpleAttentionType *type)
22225
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
106 {
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
107 g_return_val_if_fail(type != NULL, NULL);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
108
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
109 return type->name;
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
110 }
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
111
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
112 const char *
22251
a7c65a128467 const-ify paramteters to some of the new API I added. I thought I did this already.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22225
diff changeset
113 purple_attention_type_get_incoming_desc(const PurpleAttentionType *type)
22225
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
114 {
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
115 g_return_val_if_fail(type != NULL, NULL);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
116
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
117 return type->incoming_description;
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
118 }
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
119
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
120 const char *
22251
a7c65a128467 const-ify paramteters to some of the new API I added. I thought I did this already.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22225
diff changeset
121 purple_attention_type_get_outgoing_desc(const PurpleAttentionType *type)
22225
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
122 {
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
123 g_return_val_if_fail(type != NULL, NULL);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
124
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
125 return type->outgoing_description;
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
126 }
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
127
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
128 const char *
22251
a7c65a128467 const-ify paramteters to some of the new API I added. I thought I did this already.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22225
diff changeset
129 purple_attention_type_get_icon_name(const PurpleAttentionType *type)
22225
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
130 {
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
131 g_return_val_if_fail(type != NULL, NULL);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
132
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
133 if(type->icon_name == NULL || *(type->icon_name) == '\0')
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
134 return NULL;
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
135
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
136 return type->icon_name;
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
137 }
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
138
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
139 const char *
22251
a7c65a128467 const-ify paramteters to some of the new API I added. I thought I did this already.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22225
diff changeset
140 purple_attention_type_get_unlocalized_name(const PurpleAttentionType *type)
22225
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
141 {
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
142 g_return_val_if_fail(type != NULL, NULL);
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
143
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
144 return type->unlocalized_name;
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
145 }
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
146
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
147 /**************************************************************************/
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
148 /** @name Protocol Plugin API */
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
149 /**************************************************************************/
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
150 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
151 purple_protocol_got_account_idle(PurpleAccount *account, gboolean idle,
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
152 time_t idle_time)
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 g_return_if_fail(account != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
155 g_return_if_fail(purple_account_is_connected(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
156
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
157 purple_presence_set_idle(purple_account_get_presence(account),
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
158 idle, idle_time);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
159 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
160
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
161 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
162 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
163 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
164 PurplePresence *presence;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
165
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
166 g_return_if_fail(account != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
167 g_return_if_fail(purple_account_is_connected(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
168
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
169 if (login_time == 0)
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
170 login_time = time(NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
171
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
172 presence = purple_account_get_presence(account);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
173
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
174 purple_presence_set_login_time(presence, login_time);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
175 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
176
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
177 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
178 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
179 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
180 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
181 PurpleStatus *status;
13374
e5da5325b1fa [gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13335
diff changeset
182 va_list args;
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 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
185 g_return_if_fail(status_id != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
186 g_return_if_fail(purple_account_is_connected(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
187
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
188 presence = purple_account_get_presence(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
189 status = purple_presence_get_status(presence, status_id);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
190
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
191 g_return_if_fail(status != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
192
13374
e5da5325b1fa [gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13335
diff changeset
193 va_start(args, status_id);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
194 purple_status_set_active_with_attrs(status, TRUE, args);
13374
e5da5325b1fa [gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13335
diff changeset
195 va_end(args);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
196 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
197
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
198 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
199 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
200 {
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
201
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
202 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
203 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
204
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
205 purple_signal_emit(purple_accounts_get_handle(), "account-actions-changed",
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
206 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
207 }
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
208
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
209 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
210 purple_protocol_got_user_idle(PurpleAccount *account, const char *name,
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
211 gboolean idle, time_t idle_time)
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
212 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
213 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
214 GSList *list;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
215
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
216 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
217 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
218 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
219
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
220 if ((list = purple_blist_find_buddies(account, name)) == NULL)
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
221 return;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
222
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
223 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
224 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
225 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
226 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
227 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
228 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
229
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
230 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
231 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
232 time_t login_time)
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
233 {
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
234 GSList *list;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
235 PurplePresence *presence;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
236
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
237 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
238 g_return_if_fail(name != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
239
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
240 if ((list = purple_blist_find_buddies(account, name)) == NULL)
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
241 return;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
242
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
243 if (login_time == 0)
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
244 login_time = time(NULL);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
245
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
246 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
247 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
248 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
249 list = g_slist_delete_link(list, list);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
250
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
251 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
252 {
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
253 purple_presence_set_login_time(presence, login_time);
15212
2919bfea7c4a [gaim-migrate @ 17936]
Evan Schoenberg <evands@pidgin.im>
parents: 14254
diff changeset
254
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
255 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
256 }
15311
f5cf28c6e665 [gaim-migrate @ 18039]
Evan Schoenberg <evands@pidgin.im>
parents: 15212
diff changeset
257 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
258 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
259
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
260 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
261 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
262 const char *status_id, ...)
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
263 {
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
264 GSList *list, *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
265 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
266 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
267 PurpleStatus *status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
268 PurpleStatus *old_status;
13374
e5da5325b1fa [gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13335
diff changeset
269 va_list args;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
270
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
271 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
272 g_return_if_fail(name != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
273 g_return_if_fail(status_id != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
274 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
275
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
276 if((list = purple_blist_find_buddies(account, name)) == NULL)
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
277 return;
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
278
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
279 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
280 buddy = l->data;
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
281
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
282 presence = purple_buddy_get_presence(buddy);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
283 status = purple_presence_get_status(presence, status_id);
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
284
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
285 if(NULL == status)
27786
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
286 /*
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
287 * TODO: This should never happen, right? We should call
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
288 * g_warning() or something.
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
289 */
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
290 continue;
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
291
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
292 old_status = purple_presence_get_active_status(presence);
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
293
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
294 va_start(args, status_id);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
295 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
296 va_end(args);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
297
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
298 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
299 }
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
300
12126
3b70215e9630 [gaim-migrate @ 14426]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12108
diff changeset
301 g_slist_free(list);
12654
2e25e75190c4 [gaim-migrate @ 14997]
Mark Doliner <markdoliner@pidgin.im>
parents: 12377
diff changeset
302
27596
bc7058e10c04 Make the comment reflect that we are actually just stopping the typing
Etan Reisner <deryni@pidgin.im>
parents: 26871
diff changeset
303 /* 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
304 * 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
305 if (!purple_status_is_online(status)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
306 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
307 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
308 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
309 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
310
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
311 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
312 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
313 {
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
314 GSList *list, *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
315 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
316 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
317 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
318
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
319 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
320 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
321 g_return_if_fail(status_id != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
322 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
323
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
324 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
325 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
326
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
327 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
328 buddy = l->data;
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
329
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
330 presence = purple_buddy_get_presence(buddy);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
331 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
332
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
333 if(NULL == status)
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
334 continue;
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
335
19692
06e6aba21930 Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19654
diff changeset
336 if (purple_status_is_active(status)) {
06e6aba21930 Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19654
diff changeset
337 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
338 purple_buddy_update_status(buddy, status);
19692
06e6aba21930 Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19654
diff changeset
339 }
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
340 }
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
341
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
342 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
343 }
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
344
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
345 static void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
346 do_protocol_change_account_status(PurpleAccount *account,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
347 PurpleStatus *old_status, PurpleStatus *new_status)
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
348 {
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
349 PurpleProtocol *protocol;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
350
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
351 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
352 purple_account_is_disconnected(account) &&
d4af3d043211 Improve our NetworkManager support in a couple of ways:
Richard Laager <rlaager@pidgin.im>
parents: 23875
diff changeset
353 purple_network_is_available())
11718
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
354 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
355 purple_account_connect(account);
11718
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
356 return;
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
357 }
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
358
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
359 if (!purple_status_is_online(new_status))
14224
d6d41ff969df [gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14097
diff changeset
360 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
361 if (!purple_account_is_disconnected(account))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
362 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
363 /* Clear out the unsaved password if we switch to offline status */
99bad5c80d1e More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34029
diff changeset
364 if (!purple_account_get_remember_password(account))
99bad5c80d1e More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34029
diff changeset
365 purple_account_set_password(account, NULL, NULL, NULL);
34019
bc87f596bb4c compile, appears to work too.
Ka-Hing Cheung <khc@pidgin.im>
parents: 34018
diff changeset
366
14224
d6d41ff969df [gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14097
diff changeset
367 return;
d6d41ff969df [gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14097
diff changeset
368 }
11718
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
369
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
370 if (purple_account_is_connecting(account))
12108
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
371 /*
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
372 * We don't need to call the set_status PRPL function because
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
373 * the PRPL will take care of setting its status during the
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
374 * connection process.
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
375 */
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
376 return;
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
377
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
378 protocol = purple_find_protocol_info(purple_account_get_protocol_id(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
379
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
380 if (protocol == NULL)
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
381 return;
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
382
36619
bade26478caa Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents: 36617
diff changeset
383 if (!purple_account_is_disconnected(account))
36606
9fe2d65fe1a7 Use the purple_protocol_iface_* API instead of protocol->function()
Ankit Vani <a@nevitus.org>
parents: 36571
diff changeset
384 purple_protocol_iface_set_status(protocol, account, new_status);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
385 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
386
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
387 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
388 purple_protocol_change_account_status(PurpleAccount *account,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
389 PurpleStatus *old_status, PurpleStatus *new_status)
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
390 {
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
391 g_return_if_fail(account != NULL);
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
392 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
393 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
394
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
395 do_protocol_change_account_status(account, old_status, new_status);
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
396
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
397 purple_signal_emit(purple_accounts_get_handle(), "account-status-changed",
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
398 account, old_status, new_status);
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
399 }
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
400
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
401 GList *
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
402 purple_protocol_get_statuses(PurpleAccount *account, PurplePresence *presence)
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
403 {
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
404 GList *statuses = NULL;
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18177
diff changeset
405 GList *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
406 PurpleStatus *status;
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
407
10447
887380ec66f5 [gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents: 10052
diff changeset
408 g_return_val_if_fail(account != NULL, NULL);
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
409 g_return_val_if_fail(presence != NULL, NULL);
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
410
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
411 for (l = purple_account_get_status_types(account); l != NULL; l = l->next)
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
412 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
413 status = purple_status_new((PurpleStatusType *)l->data, presence);
15657
a9e38c097d28 sf patch #1655057, from Peter Tang
Mark Doliner <markdoliner@pidgin.im>
parents: 15588
diff changeset
414 statuses = g_list_prepend(statuses, status);
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
415 }
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
416
15657
a9e38c097d28 sf patch #1655057, from Peter Tang
Mark Doliner <markdoliner@pidgin.im>
parents: 15588
diff changeset
417 statuses = g_list_reverse(statuses);
11730
649c38d2a8ab [gaim-migrate @ 14021]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11718
diff changeset
418
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
419 return statuses;
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
420 }
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
421
29487
1fa2077fb506 Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents: 29486
diff changeset
422 static void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
423 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
424 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
425 {
1fa2077fb506 Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents: 29486
diff changeset
426 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
427 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
428 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
429 account, who, conv, type);
1fa2077fb506 Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents: 29486
diff changeset
430 }
1fa2077fb506 Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents: 29486
diff changeset
431
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
432 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
433 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
434 {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
435 PurpleAttentionType *attn;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
436 PurpleMessageFlags flags;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
437 PurpleProtocol *protocol;
34656
adbcbe04077c Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34627
diff changeset
438 PurpleIMConversation *im;
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
439 PurpleBuddy *buddy;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25869
diff changeset
440 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
441 gchar *description;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
442 time_t mtime;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
443
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
444 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
445 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
446
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
447 protocol = purple_find_protocol_info(purple_account_get_protocol_id(purple_connection_get_account(gc)));
36620
c76013b145f4 Added PURPLE_PROTOCOL_IMPLEMENTS(protocol,func) to check if a protocol implements a function
Ankit Vani <a@nevitus.org>
parents: 36619
diff changeset
448 g_return_if_fail(PURPLE_PROTOCOL_IMPLEMENTS(protocol, send_attention));
23875
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 mtime = time(NULL);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
451
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32554
diff changeset
452 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
453
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
454 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
455 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
456 else
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
457 alias = who;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
458
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
459 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
460 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
461 } else {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
462 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
463 }
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25869
diff changeset
464
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
465 flags = PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
466
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
467 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
468 description, who);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
469
36619
bade26478caa Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents: 36617
diff changeset
470 if (!purple_protocol_iface_send_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
471 return;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
472
34656
adbcbe04077c Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34627
diff changeset
473 im = purple_im_conversation_new(purple_connection_get_account(gc), who);
adbcbe04077c Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34627
diff changeset
474 purple_conversation_write_message(PURPLE_CONVERSATION(im), NULL, description, flags, mtime);
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
475 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
476
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
477 g_free(description);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
478 }
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
479
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
480 static void
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
481 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
482 {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
483 PurpleMessageFlags flags;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
484 PurpleAttentionType *attn;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
485 PurpleBuddy *buddy;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
486 const char *alias;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
487 gchar *description;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
488 time_t mtime;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
489
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
490 mtime = time(NULL);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
491
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32554
diff changeset
492 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
493
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
494 /* 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
495 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
496
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
497 /* 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
498 * 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
499
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
500 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
501 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
502 else
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
503 alias = who;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
504
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
505 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
506 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
507 } else {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
508 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
509 }
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
510
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
511 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
512 description, who);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
513
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
514 if (id == -1)
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
515 serv_got_im(gc, who, description, flags, mtime);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
516 else
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
517 serv_got_chat_in(gc, id, who, flags, description, mtime);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
518
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
519 /* 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
520
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
521 g_free(description);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
522 }
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
523
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
524 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
525 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
526 {
29485
ee00ab964bcb Let _got_attention call _conversation_attention, instead of having prpls do it
Marcus Lundblad <malu@pidgin.im>
parents: 29483
diff changeset
527 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
528 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
529
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
530 got_attention(gc, -1, who, type_code);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
531 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
532 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
533 if (conv)
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
534 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
535 time(NULL));
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
536 }
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
537
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
538 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
539 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
540 {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
541 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
542 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
543
26495
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26482
diff changeset
544 gboolean
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
545 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
546 const char *who,
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26107
diff changeset
547 PurpleMediaSessionType type)
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
548 {
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
549 #ifdef USE_VV
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
550 PurpleConnection *gc = NULL;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
551 PurpleProtocol *protocol = NULL;
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
552
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
553 if (account)
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
554 gc = purple_account_get_connection(account);
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
555 if (gc)
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
556 protocol = purple_connection_get_protocol_info(gc);
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
557
36619
bade26478caa Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents: 36617
diff changeset
558 if (protocol) {
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
559 /* should check that the protocol supports this media type here? */
36606
9fe2d65fe1a7 Use the purple_protocol_iface_* API instead of protocol->function()
Ankit Vani <a@nevitus.org>
parents: 36571
diff changeset
560 return purple_protocol_iface_initiate_media(protocol, account, who, type);
26495
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26482
diff changeset
561 } else
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
562 #endif
26495
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26482
diff changeset
563 return FALSE;
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
564 }
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
565
26316
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26260
diff changeset
566 PurpleMediaCaps
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
567 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
568 {
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
569 #ifdef USE_VV
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
570 PurpleConnection *gc = NULL;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
571 PurpleProtocol *protocol = NULL;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
572
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
573 if (account)
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
574 gc = purple_account_get_connection(account);
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
575 if (gc)
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
576 protocol = purple_connection_get_protocol_info(gc);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
577
36619
bade26478caa Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents: 36617
diff changeset
578 if (protocol)
36606
9fe2d65fe1a7 Use the purple_protocol_iface_* API instead of protocol->function()
Ankit Vani <a@nevitus.org>
parents: 36571
diff changeset
579 return purple_protocol_iface_get_media_caps(protocol, account, who);
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
580 #endif
26316
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26260
diff changeset
581 return PURPLE_MEDIA_CAPS_NONE;
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
582 }
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
583
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
584 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
585 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
586 {
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
587 #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
588 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
589
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
590 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
591 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
592
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
593 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
594 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
595
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
596 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
597 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
598 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
599 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
600 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
601 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
602
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
603
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
604 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
605 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
606
c1d3cb9db1d7 update prpl.c to use the new purple_buddy_[gs]et_media_caps api
Gary Kramlich <grim@reaperworld.com>
parents: 29653
diff changeset
607 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
608 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
609
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
610 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
611 "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
612 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
613 }
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
614 #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
615 }
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
616
36487
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
617 PurpleProtocolAction *
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
618 purple_protocol_action_new(const char* label,
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
619 PurpleProtocolActionCallback callback)
36388
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
620 {
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
621 PurpleProtocolAction *action;
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
622
36488
48c3419844f0 Undo action-related changes in UI
Ankit Vani <a@nevitus.org>
parents: 36487
diff changeset
623 g_return_val_if_fail(label != NULL && callback != NULL, NULL);
36388
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
624
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
625 action = g_new0(PurpleProtocolAction, 1);
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
626
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
627 action->label = g_strdup(label);
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
628 action->callback = callback;
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
629
36487
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
630 return action;
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
631 }
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
632
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
633 void
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
634 purple_protocol_action_free(PurpleProtocolAction *action)
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
635 {
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
636 g_return_if_fail(action != NULL);
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
637
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
638 g_free(action->label);
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
639 g_free(action);
36388
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
640 }
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
641
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
642 /**************************************************************************
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
643 * Protocols API
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
644 **************************************************************************/
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
645 PurpleProtocol *
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
646 purple_find_protocol_info(const char *id)
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
647 {
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
648 return g_hash_table_lookup(protocols, id);
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
649 }
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
650
36571
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
651 PurpleProtocol *
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
652 purple_protocols_add(GType protocol_type)
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
653 {
36612
4129d1ac5c1e Check if a protocol type is valid before adding it
Ankit Vani <a@nevitus.org>
parents: 36608
diff changeset
654 PurpleProtocol *protocol;
4129d1ac5c1e Check if a protocol type is valid before adding it
Ankit Vani <a@nevitus.org>
parents: 36608
diff changeset
655
36619
bade26478caa Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents: 36617
diff changeset
656 g_return_val_if_fail(protocol_type != G_TYPE_INVALID &&
bade26478caa Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents: 36617
diff changeset
657 protocol_type != G_TYPE_NONE, NULL);
36612
4129d1ac5c1e Check if a protocol type is valid before adding it
Ankit Vani <a@nevitus.org>
parents: 36608
diff changeset
658
4129d1ac5c1e Check if a protocol type is valid before adding it
Ankit Vani <a@nevitus.org>
parents: 36608
diff changeset
659 protocol = g_object_new(protocol_type, NULL);
36571
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
660 if (purple_find_protocol_info(purple_protocol_get_id(protocol))) {
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
661 g_object_unref(protocol);
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
662 return NULL;
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
663 }
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
664
36571
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
665 g_hash_table_insert(protocols, g_strdup(purple_protocol_get_id(protocol)),
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
666 protocol);
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
667 return protocol;
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
668 }
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
669
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
670 gboolean purple_protocols_remove(PurpleProtocol *protocol)
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
671 {
36571
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
672 if (purple_find_protocol_info(purple_protocol_get_id(protocol)) == NULL)
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
673 return FALSE;
36455
27fb01531390 Destroy options, splits and actions when a protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36396
diff changeset
674
36571
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
675 g_hash_table_remove(protocols, purple_protocol_get_id(protocol));
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
676 return TRUE;
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
677 }
10036
743f585a1141 [gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents: 10023
diff changeset
678
36378
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
679 GList *
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
680 purple_protocols_get_all(void)
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
681 {
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
682 GList *ret = NULL;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
683 PurpleProtocol *protocol;
36378
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
684 GHashTableIter iter;
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
685
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
686 g_hash_table_iter_init(&iter, protocols);
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
687 while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&protocol))
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
688 ret = g_list_append(ret, protocol);
36378
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
689
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
690 return ret;
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
691 }
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
692
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
693 /**************************************************************************
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
694 * Protocols Subsystem API
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
695 **************************************************************************/
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
696 void
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
697 purple_protocols_init(void)
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
698 {
36465
3de2f1bf700b Free the correct stuff
Ankit Vani <a@nevitus.org>
parents: 36462
diff changeset
699 protocols = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
36617
be16459a68e9 Finished implementation of protocol object and interface stuff in protocol.[ch].
Ankit Vani <a@nevitus.org>
parents: 36612
diff changeset
700 (GDestroyNotify)g_object_unref);
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
701 }
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
702
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
703 void *
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
704 purple_protocols_get_handle(void)
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
705 {
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
706 static int handle;
981
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
707
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
708 return &handle;
981
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
709 }
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
710
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
711 void
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
712 purple_protocols_uninit(void)
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
713 {
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
714 g_hash_table_destroy(protocols);
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
715 }
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
716

mercurial