libpurple/protocols.c

Sun, 01 Sep 2013 03:17:23 +0530

author
Ankit Vani <a@nevitus.org>
date
Sun, 01 Sep 2013 03:17:23 +0530
branch
soc.2013.gobjectification.plugins
changeset 36631
972b9fbb3690
parent 36629
b3db84cfb283
child 36637
9b0109ae118d
permissions
-rw-r--r--

Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface

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
36624
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
147 /**************************************************************************
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
148 * GBoxed code for PurpleAttentionType
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
149 **************************************************************************/
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
150
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
151 static PurpleAttentionType *
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
152 purple_attention_type_copy(PurpleAttentionType *attn)
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
153 {
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
154 PurpleAttentionType *attn_copy;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
155
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
156 g_return_val_if_fail(attn != NULL, NULL);
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
157
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
158 attn_copy = g_new(PurpleAttentionType, 1);
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
159 *attn_copy = *attn;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
160
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
161 return attn_copy;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
162 }
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
163
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
164 GType
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
165 purple_attention_type_get_type(void)
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
166 {
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
167 static GType type = 0;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
168
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
169 if (type == 0) {
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
170 type = g_boxed_type_register_static("PurpleAttentionType",
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
171 (GBoxedCopyFunc)purple_attention_type_copy,
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
172 (GBoxedFreeFunc)g_free);
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
173 }
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
174
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
175 return type;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
176 }
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
177
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
178 /**************************************************************************
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
179 * GBoxed code for PurpleProtocolChatEntry
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
180 **************************************************************************/
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
181
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
182 static PurpleProtocolChatEntry *
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
183 purple_protocol_chat_entry_copy(PurpleProtocolChatEntry *pce)
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
184 {
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
185 PurpleProtocolChatEntry *pce_copy;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
186
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
187 g_return_val_if_fail(pce != NULL, NULL);
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
188
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
189 pce_copy = g_new(PurpleProtocolChatEntry, 1);
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
190 *pce_copy = *pce;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
191
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
192 return pce_copy;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
193 }
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
194
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
195 GType
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
196 purple_protocol_chat_entry_get_type(void)
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
197 {
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
198 static GType type = 0;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
199
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
200 if (type == 0) {
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
201 type = g_boxed_type_register_static("PurpleProtocolChatEntry",
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
202 (GBoxedCopyFunc)purple_protocol_chat_entry_copy,
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
203 (GBoxedFreeFunc)g_free);
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
204 }
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
205
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
206 return type;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
207 }
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
208
22225
6cd802a8c5ad This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21720
diff changeset
209 /**************************************************************************/
36624
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
210 /** @name Protocol API */
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
211 /**************************************************************************/
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
212 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
213 purple_protocol_got_account_idle(PurpleAccount *account, gboolean idle,
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
214 time_t idle_time)
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);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
217 g_return_if_fail(purple_account_is_connected(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
218
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
219 purple_presence_set_idle(purple_account_get_presence(account),
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
220 idle, idle_time);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
221 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
222
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
223 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
224 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
225 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
226 PurplePresence *presence;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
227
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
228 g_return_if_fail(account != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
229 g_return_if_fail(purple_account_is_connected(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
230
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
231 if (login_time == 0)
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
232 login_time = time(NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
233
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
234 presence = purple_account_get_presence(account);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
235
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
236 purple_presence_set_login_time(presence, login_time);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
237 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
238
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
239 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
240 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
241 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
242 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
243 PurpleStatus *status;
13374
e5da5325b1fa [gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13335
diff changeset
244 va_list args;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
245
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
246 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
247 g_return_if_fail(status_id != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
248 g_return_if_fail(purple_account_is_connected(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
249
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
250 presence = purple_account_get_presence(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
251 status = purple_presence_get_status(presence, status_id);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
252
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
253 g_return_if_fail(status != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
254
13374
e5da5325b1fa [gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13335
diff changeset
255 va_start(args, status_id);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
256 purple_status_set_active_with_attrs(status, TRUE, args);
13374
e5da5325b1fa [gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13335
diff changeset
257 va_end(args);
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_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
262 {
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
263
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
264 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
265 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
266
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
267 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
268 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
269 }
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
270
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26746
diff changeset
271 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
272 purple_protocol_got_user_idle(PurpleAccount *account, const char *name,
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
273 gboolean idle, time_t idle_time)
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
274 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
275 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
276 GSList *list;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
277
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
278 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
279 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
280 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
281
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
282 if ((list = purple_blist_find_buddies(account, name)) == NULL)
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
283 return;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
284
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
285 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
286 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
287 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
288 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
289 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
290 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
291
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
292 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
293 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
294 time_t login_time)
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
295 {
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
296 GSList *list;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
297 PurplePresence *presence;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
298
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
299 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
300 g_return_if_fail(name != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
301
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
302 if ((list = purple_blist_find_buddies(account, name)) == NULL)
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
303 return;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
304
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
305 if (login_time == 0)
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
306 login_time = time(NULL);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
307
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
308 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
309 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
310 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
311 list = g_slist_delete_link(list, list);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
312
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
313 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
314 {
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
315 purple_presence_set_login_time(presence, login_time);
15212
2919bfea7c4a [gaim-migrate @ 17936]
Evan Schoenberg <evands@pidgin.im>
parents: 14254
diff changeset
316
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
317 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
318 }
15311
f5cf28c6e665 [gaim-migrate @ 18039]
Evan Schoenberg <evands@pidgin.im>
parents: 15212
diff changeset
319 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
320 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
321
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
322 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
323 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
324 const char *status_id, ...)
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
325 {
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
326 GSList *list, *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
327 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
328 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
329 PurpleStatus *status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
330 PurpleStatus *old_status;
13374
e5da5325b1fa [gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13335
diff changeset
331 va_list args;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
332
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
333 g_return_if_fail(account != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
334 g_return_if_fail(name != NULL);
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
335 g_return_if_fail(status_id != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
336 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
337
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
338 if((list = purple_blist_find_buddies(account, name)) == NULL)
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
339 return;
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
340
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
341 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
342 buddy = l->data;
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
343
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
344 presence = purple_buddy_get_presence(buddy);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
345 status = purple_presence_get_status(presence, status_id);
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
346
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
347 if(NULL == status)
27786
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
348 /*
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
349 * TODO: This should never happen, right? We should call
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
350 * g_warning() or something.
630525efd6b0 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 27596
diff changeset
351 */
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
352 continue;
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
353
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
354 old_status = purple_presence_get_active_status(presence);
12176
ee1aea253ce3 [gaim-migrate @ 14478]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12126
diff changeset
355
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
356 va_start(args, status_id);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
357 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
358 va_end(args);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
359
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
360 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
361 }
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
362
12126
3b70215e9630 [gaim-migrate @ 14426]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12108
diff changeset
363 g_slist_free(list);
12654
2e25e75190c4 [gaim-migrate @ 14997]
Mark Doliner <markdoliner@pidgin.im>
parents: 12377
diff changeset
364
27596
bc7058e10c04 Make the comment reflect that we are actually just stopping the typing
Etan Reisner <deryni@pidgin.im>
parents: 26871
diff changeset
365 /* 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
366 * 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
367 if (!purple_status_is_online(status)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
368 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
369 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
370 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
371 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
372
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
373 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
374 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
375 {
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
376 GSList *list, *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
377 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
378 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
379 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
380
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
381 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
382 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
383 g_return_if_fail(status_id != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
384 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
385
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
386 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
387 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
388
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
389 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
390 buddy = l->data;
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
391
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
392 presence = purple_buddy_get_presence(buddy);
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
393 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
394
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
395 if(NULL == status)
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
396 continue;
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
397
19692
06e6aba21930 Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19654
diff changeset
398 if (purple_status_is_active(status)) {
06e6aba21930 Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19654
diff changeset
399 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
400 purple_buddy_update_status(buddy, status);
19692
06e6aba21930 Deactivate only an active status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19654
diff changeset
401 }
16958
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
402 }
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
403
c95f16df72f6 this should fix 647, and a few others
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
404 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
405 }
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
406
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
407 static void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
408 do_protocol_change_account_status(PurpleAccount *account,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
409 PurpleStatus *old_status, PurpleStatus *new_status)
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
410 {
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
411 PurpleProtocol *protocol;
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
412
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
413 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
414 purple_account_is_disconnected(account) &&
d4af3d043211 Improve our NetworkManager support in a couple of ways:
Richard Laager <rlaager@pidgin.im>
parents: 23875
diff changeset
415 purple_network_is_available())
11718
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
416 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
417 purple_account_connect(account);
11718
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
418 return;
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
419 }
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
420
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
421 if (!purple_status_is_online(new_status))
14224
d6d41ff969df [gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14097
diff changeset
422 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
423 if (!purple_account_is_disconnected(account))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
424 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
425 /* 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
426 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
427 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
428
14224
d6d41ff969df [gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14097
diff changeset
429 return;
d6d41ff969df [gaim-migrate @ 16810]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14097
diff changeset
430 }
11718
90804d019837 [gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents: 11628
diff changeset
431
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
432 if (purple_account_is_connecting(account))
12108
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
433 /*
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
434 * 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
435 * 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
436 * connection process.
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
437 */
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
438 return;
a74fd0d6b79c [gaim-migrate @ 14408]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11948
diff changeset
439
36624
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
440 protocol = purple_protocols_find(purple_account_get_protocol_id(account));
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
441
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
442 if (protocol == NULL)
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
443 return;
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
444
36619
bade26478caa Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents: 36617
diff changeset
445 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
446 purple_protocol_iface_set_status(protocol, account, new_status);
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
447 }
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
448
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
449 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
450 purple_protocol_change_account_status(PurpleAccount *account,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
451 PurpleStatus *old_status, PurpleStatus *new_status)
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
452 {
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
453 g_return_if_fail(account != NULL);
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
454 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
455 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
456
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
457 do_protocol_change_account_status(account, old_status, new_status);
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
458
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
459 purple_signal_emit(purple_accounts_get_handle(), "account-status-changed",
12304
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
460 account, old_status, new_status);
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
461 }
e849bc5e8d5d [gaim-migrate @ 14608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12176
diff changeset
462
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
463 GList *
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
464 purple_protocol_get_statuses(PurpleAccount *account, PurplePresence *presence)
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
465 {
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
466 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
467 GList *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
468 PurpleStatus *status;
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
469
10447
887380ec66f5 [gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents: 10052
diff changeset
470 g_return_val_if_fail(account != NULL, NULL);
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
471 g_return_val_if_fail(presence != NULL, NULL);
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
472
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
473 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
474 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15657
diff changeset
475 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
476 statuses = g_list_prepend(statuses, status);
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
477 }
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
478
15657
a9e38c097d28 sf patch #1655057, from Peter Tang
Mark Doliner <markdoliner@pidgin.im>
parents: 15588
diff changeset
479 statuses = g_list_reverse(statuses);
11730
649c38d2a8ab [gaim-migrate @ 14021]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11718
diff changeset
480
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
481 return statuses;
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
482 }
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9949
diff changeset
483
29487
1fa2077fb506 Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents: 29486
diff changeset
484 static void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
485 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
486 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
487 {
1fa2077fb506 Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents: 29486
diff changeset
488 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
489 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
490 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
491 account, who, conv, type);
1fa2077fb506 Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents: 29486
diff changeset
492 }
1fa2077fb506 Remove purple_conversation_attention (also let prpl_send_attention handle
Marcus Lundblad <malu@pidgin.im>
parents: 29486
diff changeset
493
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
494 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
495 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
496 {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
497 PurpleAttentionType *attn;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
498 PurpleMessageFlags flags;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
499 PurpleProtocol *protocol;
34656
adbcbe04077c Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34627
diff changeset
500 PurpleIMConversation *im;
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
501 PurpleBuddy *buddy;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25869
diff changeset
502 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
503 gchar *description;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
504 time_t mtime;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
505
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
506 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
507 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
508
36624
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
509 protocol = purple_protocols_find(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
510 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
511
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
512 mtime = time(NULL);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
513
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32554
diff changeset
514 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
515
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
516 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
517 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
518 else
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
519 alias = who;
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 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
522 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
523 } else {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
524 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
525 }
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25869
diff changeset
526
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
527 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
528
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
529 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
530 description, who);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
531
36619
bade26478caa Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents: 36617
diff changeset
532 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
533 return;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
534
34656
adbcbe04077c Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34627
diff changeset
535 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
536 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
537 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
538
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
539 g_free(description);
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
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
542 static void
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
543 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
544 {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
545 PurpleMessageFlags flags;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
546 PurpleAttentionType *attn;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
547 PurpleBuddy *buddy;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
548 const char *alias;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
549 gchar *description;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
550 time_t mtime;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
551
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
552 mtime = time(NULL);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
553
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32554
diff changeset
554 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
555
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
556 /* 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
557 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
558
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
559 /* 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
560 * 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
561
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
562 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
563 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
564 else
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
565 alias = who;
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
566
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
567 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
568 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
569 } else {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
570 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
571 }
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
572
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
573 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
574 description, who);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
575
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
576 if (id == -1)
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
577 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
578 else
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
579 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
580
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
581 /* 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
582
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
583 g_free(description);
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
584 }
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
585
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
586 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
587 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
588 {
29485
ee00ab964bcb Let _got_attention call _conversation_attention, instead of having prpls do it
Marcus Lundblad <malu@pidgin.im>
parents: 29483
diff changeset
589 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
590 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
591
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
592 got_attention(gc, -1, who, type_code);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
593 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
594 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
595 if (conv)
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
596 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
597 time(NULL));
23875
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
598 }
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
599
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
600 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
601 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
602 {
d7e5f66cbfc9 Add purple_prpl_got_attention_in_chat, then deprecate
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22251
diff changeset
603 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
604 }
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
605
26495
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26482
diff changeset
606 gboolean
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
607 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
608 const char *who,
26108
8d0fd2f195aa Changed PurpleMediaStreamType to PurpleMediaSessionType.
Michael Ruprecht <maiku@pidgin.im>
parents: 26107
diff changeset
609 PurpleMediaSessionType type)
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
610 {
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
611 #ifdef USE_VV
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
612 PurpleConnection *gc = NULL;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
613 PurpleProtocol *protocol = NULL;
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
614
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
615 if (account)
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
616 gc = purple_account_get_connection(account);
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
617 if (gc)
36623
caaadef03507 Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents: 36620
diff changeset
618 protocol = purple_connection_get_protocol(gc);
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
619
36619
bade26478caa Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents: 36617
diff changeset
620 if (protocol) {
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
621 /* 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
622 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
623 } else
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
624 #endif
26495
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26482
diff changeset
625 return FALSE;
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
626 }
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
627
26316
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26260
diff changeset
628 PurpleMediaCaps
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
629 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
630 {
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
631 #ifdef USE_VV
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
632 PurpleConnection *gc = NULL;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
633 PurpleProtocol *protocol = NULL;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
634
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
635 if (account)
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
636 gc = purple_account_get_connection(account);
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
637 if (gc)
36623
caaadef03507 Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents: 36620
diff changeset
638 protocol = purple_connection_get_protocol(gc);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
639
36619
bade26478caa Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents: 36617
diff changeset
640 if (protocol)
36606
9fe2d65fe1a7 Use the purple_protocol_iface_* API instead of protocol->function()
Ankit Vani <a@nevitus.org>
parents: 36571
diff changeset
641 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
642 #endif
26316
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26260
diff changeset
643 return PURPLE_MEDIA_CAPS_NONE;
26099
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
644 }
2ba28e840a95 Convert serv_* media functions to purple_prpl_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 22251
diff changeset
645
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
646 void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
647 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
648 {
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
649 #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
650 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
651
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
652 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
653 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
654
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34656
diff changeset
655 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
656 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
657
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
658 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
659 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
660 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
661 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
662 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
663 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
664
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29670
diff changeset
665
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
666 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
667 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
668
c1d3cb9db1d7 update prpl.c to use the new purple_buddy_[gs]et_media_caps api
Gary Kramlich <grim@reaperworld.com>
parents: 29653
diff changeset
669 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
670 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
671
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
672 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
673 "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
674 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
675 }
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
676 #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
677 }
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
678
36624
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
679 /**************************************************************************/
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
680 /** @name Protocol Action API */
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
681 /**************************************************************************/
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
682
36487
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
683 PurpleProtocolAction *
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
684 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
685 PurpleProtocolActionCallback callback)
36388
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
686 {
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
687 PurpleProtocolAction *action;
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
688
36488
48c3419844f0 Undo action-related changes in UI
Ankit Vani <a@nevitus.org>
parents: 36487
diff changeset
689 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
690
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
691 action = g_new0(PurpleProtocolAction, 1);
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
692
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
693 action->label = g_strdup(label);
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
694 action->callback = callback;
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
695
36487
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
696 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
697 }
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
698
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
699 void
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
700 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
701 {
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
702 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
703
725e37471387 Make actions a callback again, so that a plugin/protocol can change them
Ankit Vani <a@nevitus.org>
parents: 36465
diff changeset
704 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
705 g_free(action);
36388
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
706 }
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
707
207c2716f0a8 Added struct PurpleProtocolAction, and purple_protocol_actions_add().
Ankit Vani <a@nevitus.org>
parents: 36378
diff changeset
708 /**************************************************************************
36624
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
709 * GBoxed code for PurpleProtocolAction
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
710 **************************************************************************/
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
711
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
712 static PurpleProtocolAction *
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
713 purple_protocol_action_copy(PurpleProtocolAction *action)
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
714 {
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
715 g_return_val_if_fail(action != NULL, NULL);
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
716
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
717 return purple_protocol_action_new(action->label, action->callback);
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
718 }
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
719
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
720 GType
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
721 purple_protocol_action_get_type(void)
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
722 {
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
723 static GType type = 0;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
724
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
725 if (type == 0) {
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
726 type = g_boxed_type_register_static("PurpleProtocolAction",
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
727 (GBoxedCopyFunc)purple_protocol_action_copy,
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
728 (GBoxedFreeFunc)purple_protocol_action_free);
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
729 }
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
730
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
731 return type;
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
732 }
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
733
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
734 /**************************************************************************
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
735 * Protocols API
9949
377cd65fab3d [gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
736 **************************************************************************/
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
737 PurpleProtocol *
36624
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
738 purple_protocols_find(const char *id)
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
739 {
36629
b3db84cfb283 Fixed a check
Ankit Vani <a@nevitus.org>
parents: 36627
diff changeset
740 g_return_val_if_fail(protocols != NULL && id != NULL, NULL);
36624
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
741
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
742 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
743 }
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
744
36571
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
745 PurpleProtocol *
36627
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
746 purple_protocols_add(GType protocol_type, GError **error)
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
747 {
36612
4129d1ac5c1e Check if a protocol type is valid before adding it
Ankit Vani <a@nevitus.org>
parents: 36608
diff changeset
748 PurpleProtocol *protocol;
4129d1ac5c1e Check if a protocol type is valid before adding it
Ankit Vani <a@nevitus.org>
parents: 36608
diff changeset
749
36619
bade26478caa Refactored the original protocol code to use the new API
Ankit Vani <a@nevitus.org>
parents: 36617
diff changeset
750 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
751 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
752
4129d1ac5c1e Check if a protocol type is valid before adding it
Ankit Vani <a@nevitus.org>
parents: 36608
diff changeset
753 protocol = g_object_new(protocol_type, NULL);
36627
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
754
36631
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
755 if (!PURPLE_IS_PROTOCOL(protocol)) {
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
756 g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
757 _("Protocol type does not inherit PurpleProtocol"));
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
758
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
759 g_object_unref(protocol);
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
760 return NULL;
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
761 }
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
762
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
763 if (!PURPLE_IS_PROTOCOL_INTERFACE(protocol)) {
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
764 g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
765 _("Protocol does not implement PurpleProtocolInterface"));
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
766
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
767 g_object_unref(protocol);
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
768 return NULL;
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
769 }
972b9fbb3690 Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface
Ankit Vani <a@nevitus.org>
parents: 36629
diff changeset
770
36627
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
771 if (!purple_protocol_get_id(protocol)) {
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
772 g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
773 _("Protocol does not provide an ID"));
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
774
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
775 g_object_unref(protocol);
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
776 return NULL;
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
777 }
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
778
36624
38043ecaf4a6 Finished implementing functions for protocols.[ch].
Ankit Vani <a@nevitus.org>
parents: 36623
diff changeset
779 if (purple_protocols_find(purple_protocol_get_id(protocol))) {
36627
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
780 g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
781 _("A protocol with the ID %s is already added."),
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
782 purple_protocol_get_id(protocol));
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
783
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
784 g_object_unref(protocol);
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
785 return NULL;
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
786 }
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
787
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
788 /* Make sure the protocol implements the required functions */
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
789 if (!PURPLE_PROTOCOL_IMPLEMENTS(protocol, list_icon) ||
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
790 !PURPLE_PROTOCOL_IMPLEMENTS(protocol, login) ||
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
791 !PURPLE_PROTOCOL_IMPLEMENTS(protocol, close))
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
792 {
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
793 g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
794 _("Protocol %s does not implement all the required "
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
795 "functions (list_icon, login and close)"),
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
796 purple_protocol_get_id(protocol));
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
797
36571
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
798 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
799 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
800 }
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
801
36571
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
802 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
803 protocol);
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
804 return protocol;
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
805 }
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
806
36627
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
807 gboolean purple_protocols_remove(PurpleProtocol *protocol, GError **error)
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
808 {
36627
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
809 g_return_val_if_fail(protocol != NULL, FALSE);
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
810 g_return_val_if_fail(purple_protocol_get_id(protocol) != NULL, FALSE);
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
811
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
812 if (purple_protocols_find(purple_protocol_get_id(protocol)) == NULL) {
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
813 g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
814 _("Protocol %s is not added."),
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
815 purple_protocol_get_id(protocol));
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
816
36462
869de290ccfb Disconnect all accounts of a protocol when the protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36455
diff changeset
817 return FALSE;
36627
a3b0d16f69ef Added error argument to protocol add/remove funcs, along with checks to ensure protocol being added/removed is valid
Ankit Vani <a@nevitus.org>
parents: 36624
diff changeset
818 }
36455
27fb01531390 Destroy options, splits and actions when a protocol is removed
Ankit Vani <a@nevitus.org>
parents: 36396
diff changeset
819
36571
89f3e5748a68 Changed signature of purple_protocols_add() take a GType and return the PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36559
diff changeset
820 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
821 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
822 }
10036
743f585a1141 [gaim-migrate @ 10995]
Luke Schierer <lschiere@pidgin.im>
parents: 10023
diff changeset
823
36378
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
824 GList *
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
825 purple_protocols_get_all(void)
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
826 {
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
827 GList *ret = NULL;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
828 PurpleProtocol *protocol;
36378
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
829 GHashTableIter iter;
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
830
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
831 g_hash_table_iter_init(&iter, protocols);
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
832 while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&protocol))
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
833 ret = g_list_append(ret, protocol);
36378
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
834
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
835 return ret;
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
836 }
d51a8507f4e0 Added purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36375
diff changeset
837
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
838 /**************************************************************************
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
839 * 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
840 **************************************************************************/
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
841 void
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
842 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
843 {
36465
3de2f1bf700b Free the correct stuff
Ankit Vani <a@nevitus.org>
parents: 36462
diff changeset
844 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
845 (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
846 }
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5161
diff changeset
847
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
848 void *
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
849 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
850 {
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
851 static int handle;
981
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
852
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
853 return &handle;
981
00723c9a507c [gaim-migrate @ 991]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
854 }
36375
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
855
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
856 void
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
857 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
858 {
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
859 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
860 }
8ed701a7333e Added a protocols subsystem API and a protocols API to add/remove protocols.
Ankit Vani <a@nevitus.org>
parents: 36362
diff changeset
861

mercurial