Wed, 25 May 2022 23:52:45 -0500
Remove prpl-gtalk from XMPP console
It no longer exists, and complicates the code a bit.
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1 | /** |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
2 | * purple |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
3 | * |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
6 | * source distribution. |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
7 | * |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
8 | * Nullprpl is a mock protocol plugin for Pidgin and libpurple. You can create |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
9 | * accounts with it, sign on and off, add buddies, and send and receive IMs, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
10 | * all without connecting to a server! |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
11 | * |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
12 | * Beyond that basic functionality, nullprpl supports presence and |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
13 | * away/available messages, offline messages, user info, typing notification, |
| 37148 | 14 | * privacy allow/block lists, chat rooms, room lists, and protocol |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
15 | * icons and emblems. Notable missing features are file transfer and account |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
16 | * registration and authentication. |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
17 | * |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
18 | * Nullprpl is intended as an example of how to write a libpurple protocol |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
19 | * plugin. It doesn't contain networking code or an event loop, but it does |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
20 | * demonstrate how to use the libpurple API to do pretty much everything a |
|
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
21 | * protocol might need to do. |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
22 | * |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
23 | * Nullprpl is also a useful tool for hacking on Pidgin, Finch, and other |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
24 | * libpurple clients. It's a full-featured protocol plugin, but doesn't depend |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
25 | * on an external server, so it's a quick and easy way to exercise test new |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
26 | * code. It also allows you to work while you're disconnected. |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
27 | * |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
28 | * This program is free software; you can redistribute it and/or modify |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
29 | * it under the terms of the GNU General Public License as published by |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
30 | * the Free Software Foundation; either version 2 of the License, or |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
31 | * (at your option) any later version. |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
32 | * |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
33 | * This program is distributed in the hope that it will be useful, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
36 | * GNU General Public License for more details. |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
37 | * |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
38 | * You should have received a copy of the GNU General Public License |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
39 | * 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:
19832
diff
changeset
|
40 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
41 | */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
42 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
43 | #include <stdarg.h> |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
44 | #include <string.h> |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
45 | #include <time.h> |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
46 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
47 | #include <glib.h> |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40087
diff
changeset
|
48 | #include <glib/gi18n-lib.h> |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
49 | |
|
40945
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
50 | #include <gplugin.h> |
|
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
51 | #include <gplugin-native.h> |
|
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
52 | |
|
39877
4bc87b3dbca4
Get the null prpl working again and build it by default but don't install it
Gary Kramlich <grim@reaperworld.com>
parents:
39760
diff
changeset
|
53 | #include <purple.h> |
|
24332
9c7586a57e1b
Add a comment documenting the internal.h situation for people using nullprpl
Richard Laager <rlaager@pidgin.im>
parents:
24231
diff
changeset
|
54 | |
|
37009
05ef6e29ea04
Rename nullprotocol back to nullprpl
Ankit Vani <a@nevitus.org>
parents:
36985
diff
changeset
|
55 | #include "nullprpl.h" |
|
36657
4a7f5f97d1ec
Make sure internal.h is included first
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
56 | |
|
40865
82e45cd837fa
Migrate gg, novel, null, sametime, silc, and zephyr to using G_DECLARE_FINAL_TYPE for their protocol objects
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
57 | struct _NullProtocol { |
|
82e45cd837fa
Migrate gg, novel, null, sametime, silc, and zephyr to using G_DECLARE_FINAL_TYPE for their protocol objects
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
58 | PurpleProtocol parent; |
|
82e45cd837fa
Migrate gg, novel, null, sametime, silc, and zephyr to using G_DECLARE_FINAL_TYPE for their protocol objects
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
59 | }; |
|
82e45cd837fa
Migrate gg, novel, null, sametime, silc, and zephyr to using G_DECLARE_FINAL_TYPE for their protocol objects
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
60 | |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36657
diff
changeset
|
61 | /* |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36657
diff
changeset
|
62 | * reference to the protocol instance, used for registering signals, prefs, |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36657
diff
changeset
|
63 | * etc. it is set when the protocol is added in plugin_load and is required |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36657
diff
changeset
|
64 | * for removing the protocol in plugin_unload. |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36657
diff
changeset
|
65 | */ |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
66 | static PurpleProtocol *my_protocol = NULL; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
67 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
68 | #define NULL_STATUS_ONLINE "online" |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
69 | #define NULL_STATUS_AWAY "away" |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
70 | #define NULL_STATUS_OFFLINE "offline" |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
71 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
72 | typedef void (*GcFunc)(PurpleConnection *from, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
73 | PurpleConnection *to, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
74 | gpointer userdata); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
75 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
76 | typedef struct { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
77 | GcFunc fn; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
78 | PurpleConnection *from; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
79 | gpointer userdata; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
80 | } GcFuncData; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
81 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
82 | /* |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
83 | * stores offline messages that haven't been delivered yet. maps username |
|
36677
081733748bbc
Only initialize/finalize protocol class data in *_base_init/finalize for protocols.
Ankit Vani <a@nevitus.org>
parents:
36664
diff
changeset
|
84 | * (char *) to GList * of GOfflineMessages. initialized in plugin_load. |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
85 | */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
86 | GHashTable* goffline_messages = NULL; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
87 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
88 | typedef struct { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
89 | char *from; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
90 | char *message; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
91 | time_t mtime; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
92 | PurpleMessageFlags flags; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
93 | } GOfflineMessage; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
94 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
95 | /* |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
96 | * helpers |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
97 | */ |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
98 | static PurpleConnection *get_null_gc(const char *username) { |
|
41206
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
99 | PurpleAccountManager *manager = NULL; |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
100 | PurpleAccount *acct = NULL; |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
101 | |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
102 | manager = purple_account_manager_get_default(); |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
103 | acct = purple_account_manager_find(manager, username, "null"); |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
104 | |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
105 | if (acct && purple_account_is_connected(acct)) |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
106 | return purple_account_get_connection(acct); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
107 | else |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
108 | return NULL; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
109 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
110 | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
111 | static void call_if_nullprotocol(gpointer data, gpointer userdata) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
112 | PurpleConnection *gc = (PurpleConnection *)(data); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
113 | GcFuncData *gcfdata = (GcFuncData *)userdata; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
114 | |
| 38358 | 115 | if (purple_strequal(purple_account_get_protocol_id(purple_connection_get_account(gc)), "null")) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
116 | gcfdata->fn(gcfdata->from, gc, gcfdata->userdata); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
117 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
118 | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
119 | static void foreach_null_gc(GcFunc fn, PurpleConnection *from, |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
120 | gpointer userdata) { |
| 17452 | 121 | GcFuncData gcfdata = { fn, from, userdata }; |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
122 | g_list_foreach(purple_connections_get_all(), call_if_nullprotocol, |
| 17452 | 123 | &gcfdata); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
124 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
125 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
126 | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
127 | typedef void(*ChatFunc)(PurpleConversation *from, PurpleConversation *to, |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
128 | int id, const char *room, gpointer userdata); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
129 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
130 | typedef struct { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
131 | ChatFunc fn; |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
132 | PurpleConversation *from_chat; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
133 | gpointer userdata; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
134 | } ChatFuncData; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
135 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
136 | static void call_chat_func(gpointer data, gpointer userdata) { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
137 | PurpleConnection *to = (PurpleConnection *)data; |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
138 | PurpleConversation *chat; |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
139 | PurpleConversationManager *manager; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
140 | ChatFuncData *cfdata = (ChatFuncData *)userdata; |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
141 | int id = purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(cfdata->from_chat)); |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
142 | |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
143 | manager = purple_conversation_manager_get_default(); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
144 | chat = purple_conversation_manager_find_chat_by_id(manager, |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
145 | purple_connection_get_account(to), |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
146 | id); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
147 | if (chat) { |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
148 | cfdata->fn(cfdata->from_chat, chat, id, |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
149 | purple_conversation_get_name(chat), cfdata->userdata); |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
150 | } |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
151 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
152 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
153 | static void foreach_gc_in_chat(ChatFunc fn, PurpleConnection *from, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
154 | int id, gpointer userdata) { |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
155 | PurpleConversation *chat; |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
156 | PurpleConversationManager *manager; |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
157 | ChatFuncData cfdata = { |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
158 | .fn = fn, |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
159 | .userdata = userdata |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
160 | }; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
161 | |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
162 | manager = purple_conversation_manager_get_default(); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
163 | chat = purple_conversation_manager_find_chat_by_id(manager, |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
164 | purple_connection_get_account(from), |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
165 | id); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
166 | |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
167 | cfdata.from_chat = chat; |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
168 | |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
169 | g_list_foreach(purple_connections_get_all(), call_chat_func, &cfdata); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
170 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
171 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
172 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
173 | static void discover_status(PurpleConnection *from, PurpleConnection *to, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
174 | gpointer userdata) { |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
175 | const char *from_username = purple_account_get_username(purple_connection_get_account(from)); |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
176 | const char *to_username = purple_account_get_username(purple_connection_get_account(to)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
177 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34706
diff
changeset
|
178 | if (purple_blist_find_buddy(purple_connection_get_account(from), to_username)) { |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
179 | PurpleStatus *status = purple_account_get_active_status(purple_connection_get_account(to)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
180 | const char *status_id = purple_status_get_id(status); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
181 | const char *message = purple_status_get_attr_string(status, "message"); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
182 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31595
diff
changeset
|
183 | if (purple_strequal(status_id, NULL_STATUS_ONLINE) || |
|
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31595
diff
changeset
|
184 | purple_strequal(status_id, NULL_STATUS_AWAY) || |
|
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31595
diff
changeset
|
185 | purple_strequal(status_id, NULL_STATUS_OFFLINE)) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
186 | purple_debug_info("nullprpl", "%s sees that %s is %s: %s\n", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
187 | from_username, to_username, status_id, message); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
188 | purple_protocol_got_user_status(purple_connection_get_account(from), to_username, status_id, |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
189 | (message) ? "message" : NULL, message, NULL); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
190 | } else { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
191 | purple_debug_error("nullprpl", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
192 | "%s's buddy %s has an unknown status: %s, %s", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
193 | from_username, to_username, status_id, message); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
194 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
195 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
196 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
197 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
198 | static void report_status_change(PurpleConnection *from, PurpleConnection *to, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
199 | gpointer userdata) { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
200 | purple_debug_info("nullprpl", "notifying %s that %s changed status\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
201 | purple_account_get_username(purple_connection_get_account(to)), purple_account_get_username(purple_connection_get_account(from))); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
202 | discover_status(to, from, NULL); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
203 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
204 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
205 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
206 | /* |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
207 | * UI callbacks |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
208 | */ |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
209 | static void null_input_user_info(PurpleProtocolAction *action) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
210 | { |
|
36453
75bb4001a25f
Refactored nullprpl to build with the new plugin API. This is not final.
Ankit Vani <a@nevitus.org>
parents:
34872
diff
changeset
|
211 | PurpleConnection *gc = action->connection; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
212 | PurpleAccount *acct = purple_connection_get_account(gc); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
213 | purple_debug_info("nullprpl", "showing 'Set User Info' dialog for %s\n", |
|
32623
547eacef0b63
Convert libpurple and protocol prpl's to use the purple_account_* accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32618
diff
changeset
|
214 | purple_account_get_username(acct)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
215 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
216 | purple_account_request_change_user_info(acct); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
217 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
218 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
219 | /* |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36628
diff
changeset
|
220 | * Protocol functions |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
221 | */ |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
222 | static GList * |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
223 | null_get_actions(PurpleProtocolClient *client, PurpleConnection *gc) { |
|
36494
40bae9b0c9fc
Updated nullprpl according to the changes
Ankit Vani <a@nevitus.org>
parents:
36486
diff
changeset
|
224 | PurpleProtocolAction *action = purple_protocol_action_new( |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
225 | _("Set User Info..."), null_input_user_info); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
226 | return g_list_append(NULL, action); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
227 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
228 | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
229 | static const char *null_list_icon(PurpleAccount *acct, PurpleBuddy *buddy) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
230 | { |
|
25002
40a1b3360a50
Various nullprpl fixes.
Richard Laager <rlaager@pidgin.im>
parents:
24332
diff
changeset
|
231 | return "null"; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
232 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
233 | |
|
40813
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
234 | static GList * |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
235 | null_protocol_get_account_options(PurpleProtocol *protocol) { |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
236 | PurpleAccountOption *option; |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
237 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
238 | option = purple_account_option_string_new( |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
239 | _("Example option"), /* text shown to user */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
240 | "example", /* pref name */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
241 | "default"); /* default value */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
242 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
243 | return g_list_append(NULL, option); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
244 | } |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
245 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
246 | static PurpleBuddyIconSpec * |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
247 | null_protocol_get_buddy_icon_spec(PurpleProtocol *protocol) { |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
248 | return purple_buddy_icon_spec_new( |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
249 | "png,jpg,gif", /* format */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
250 | 0, /* min_width */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
251 | 0, /* min_height */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
252 | 128, /* max_width */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
253 | 128, /* max_height */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
254 | 10000, /* max_filesize */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
255 | PURPLE_ICON_SCALE_DISPLAY /* scale_rules */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
256 | ); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
257 | } |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
258 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
259 | static GList * |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
260 | null_protocol_get_user_splits(PurpleProtocol *protocol) { |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
261 | PurpleAccountUserSplit *split; |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
262 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
263 | split = purple_account_user_split_new( |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
264 | _("Example user split"), /* text shown to user */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
265 | "default", /* default value */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
266 | '@'); /* field separator */ |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
267 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
268 | return g_list_append(NULL, split); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
269 | } |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
270 | |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
271 | static char * |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
272 | null_status_text(PurpleProtocolClient *client, PurpleBuddy *buddy) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
273 | purple_debug_info("nullprpl", "getting %s's status text for %s\n", |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
274 | purple_buddy_get_name(buddy), |
|
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
275 | purple_account_get_username(purple_buddy_get_account(buddy))); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
276 | |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
277 | if (purple_blist_find_buddy(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy))) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
278 | PurplePresence *presence = purple_buddy_get_presence(buddy); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
279 | PurpleStatus *status = purple_presence_get_active_status(presence); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
280 | const char *name = purple_status_get_name(status); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
281 | const char *message = purple_status_get_attr_string(status, "message"); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
282 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
283 | char *text; |
|
32189
3af8d41121b6
Don't use strlen() when all you're trying to do is check if the string
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
284 | if (message && *message) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
285 | text = g_strdup_printf("%s: %s", name, message); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
286 | else |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
287 | text = g_strdup(name); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
288 | |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
289 | purple_debug_info("nullprpl", "%s's status text is %s\n", |
|
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
290 | purple_buddy_get_name(buddy), text); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
291 | return text; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
292 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
293 | } else { |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
294 | purple_debug_info("nullprpl", "...but %s is not logged in\n", purple_buddy_get_name(buddy)); |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
295 | return g_strdup("Not logged in"); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
296 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
297 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
298 | |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
299 | static void |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
300 | null_tooltip_text(PurpleProtocolClient *client, PurpleBuddy *buddy, |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
301 | PurpleNotifyUserInfo *info, gboolean full) |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
302 | { |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
303 | PurpleConnection *gc = get_null_gc(purple_buddy_get_name(buddy)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
304 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
305 | if (gc) { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
306 | /* they're logged in */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
307 | PurplePresence *presence = purple_buddy_get_presence(buddy); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
308 | PurpleStatus *status = purple_presence_get_active_status(presence); |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
309 | char *msg = null_status_text(client, buddy); |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
310 | /* TODO: Check whether it's correct to call add_pair_html, |
|
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
311 | or if we should be using add_pair_plaintext */ |
|
32263
02baf4631f3b
Update nullprpl for various API changes.
Andrew Victor <andrew.victor@mxit.com>
parents:
32190
diff
changeset
|
312 | purple_notify_user_info_add_pair_html(info, purple_status_get_name(status), |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
313 | msg); |
|
24865
053ddd0ba317
Small leak fix.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24862
diff
changeset
|
314 | g_free(msg); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
315 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
316 | if (full) { |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
317 | const char *user_info = purple_account_get_user_info(purple_connection_get_account(gc)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
318 | if (user_info) |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
319 | /* TODO: Check whether it's correct to call add_pair_html, |
|
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
320 | or if we should be using add_pair_plaintext */ |
|
32263
02baf4631f3b
Update nullprpl for various API changes.
Andrew Victor <andrew.victor@mxit.com>
parents:
32190
diff
changeset
|
321 | purple_notify_user_info_add_pair_html(info, _("User info"), user_info); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
322 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
323 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
324 | } else { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
325 | /* they're not logged in */ |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
31595
diff
changeset
|
326 | purple_notify_user_info_add_pair_plaintext(info, _("User info"), _("not logged in")); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
327 | } |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
328 | |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
329 | purple_debug_info("nullprpl", "showing %s tooltip for %s\n", |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
330 | (full) ? "full" : "short", purple_buddy_get_name(buddy)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
331 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
332 | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
333 | static GList *null_status_types(PurpleAccount *acct) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
334 | { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
335 | GList *types = NULL; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
336 | PurpleStatusType *type; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
337 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
338 | purple_debug_info("nullprpl", "returning status types for %s: %s, %s, %s\n", |
|
32623
547eacef0b63
Convert libpurple and protocol prpl's to use the purple_account_* accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32618
diff
changeset
|
339 | purple_account_get_username(acct), |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
340 | NULL_STATUS_ONLINE, NULL_STATUS_AWAY, NULL_STATUS_OFFLINE); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
341 | |
|
25890
26bb4211aa76
Deprecate some functions that aren't really needed
Mark Doliner <markdoliner@pidgin.im>
parents:
25119
diff
changeset
|
342 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, |
|
26bb4211aa76
Deprecate some functions that aren't really needed
Mark Doliner <markdoliner@pidgin.im>
parents:
25119
diff
changeset
|
343 | NULL_STATUS_ONLINE, NULL, TRUE, TRUE, FALSE, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34991
diff
changeset
|
344 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
25890
26bb4211aa76
Deprecate some functions that aren't really needed
Mark Doliner <markdoliner@pidgin.im>
parents:
25119
diff
changeset
|
345 | NULL); |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
346 | types = g_list_prepend(types, type); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
347 | |
|
25890
26bb4211aa76
Deprecate some functions that aren't really needed
Mark Doliner <markdoliner@pidgin.im>
parents:
25119
diff
changeset
|
348 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, |
|
26bb4211aa76
Deprecate some functions that aren't really needed
Mark Doliner <markdoliner@pidgin.im>
parents:
25119
diff
changeset
|
349 | NULL_STATUS_AWAY, NULL, TRUE, TRUE, FALSE, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34991
diff
changeset
|
350 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
25890
26bb4211aa76
Deprecate some functions that aren't really needed
Mark Doliner <markdoliner@pidgin.im>
parents:
25119
diff
changeset
|
351 | NULL); |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
352 | types = g_list_prepend(types, type); |
|
25890
26bb4211aa76
Deprecate some functions that aren't really needed
Mark Doliner <markdoliner@pidgin.im>
parents:
25119
diff
changeset
|
353 | |
|
26bb4211aa76
Deprecate some functions that aren't really needed
Mark Doliner <markdoliner@pidgin.im>
parents:
25119
diff
changeset
|
354 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE, |
|
26bb4211aa76
Deprecate some functions that aren't really needed
Mark Doliner <markdoliner@pidgin.im>
parents:
25119
diff
changeset
|
355 | NULL_STATUS_OFFLINE, NULL, TRUE, TRUE, FALSE, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34991
diff
changeset
|
356 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
25890
26bb4211aa76
Deprecate some functions that aren't really needed
Mark Doliner <markdoliner@pidgin.im>
parents:
25119
diff
changeset
|
357 | NULL); |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
358 | types = g_list_prepend(types, type); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
359 | |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
360 | return g_list_reverse(types); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
361 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
362 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
363 | static void blist_example_menu_item(PurpleBlistNode *node, gpointer userdata) { |
|
22709
6bd336964410
Printf warning fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
364 | purple_debug_info("nullprpl", "example menu item clicked on user %s\n", |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
365 | purple_buddy_get_name(PURPLE_BUDDY(node))); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
366 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
367 | purple_notify_info(NULL, /* plugin handle or PurpleConnection */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
368 | _("Primary title"), |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
369 | _("Secondary title"), |
|
37009
05ef6e29ea04
Rename nullprotocol back to nullprpl
Ankit Vani <a@nevitus.org>
parents:
36985
diff
changeset
|
370 | _("This is the callback for the NullProtocol menu item."), |
| 34979 | 371 | NULL); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
372 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
373 | |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
374 | static GList * |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
375 | null_blist_node_menu(PurpleProtocolClient *client, PurpleBlistNode *node) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
376 | purple_debug_info("nullprpl", "providing buddy list context menu item\n"); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
377 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
378 | if (PURPLE_IS_BUDDY(node)) { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
379 | PurpleActionMenu *action = purple_action_menu_new( |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
380 | _("NullProtocol example menu item"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41206
diff
changeset
|
381 | G_CALLBACK(blist_example_menu_item), |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
382 | NULL, /* userdata passed to the callback */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
383 | NULL); /* child menu items */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
384 | return g_list_append(NULL, action); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
385 | } else { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
386 | return NULL; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
387 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
388 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
389 | |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
390 | static GList * |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
391 | null_chat_info(PurpleProtocolChat *protocol_chat, PurpleConnection *gc) { |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
392 | PurpleProtocolChatEntry *pce; /* defined in protocols.h */ |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
393 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
394 | purple_debug_info("nullprpl", "returning chat setting 'room'\n"); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
395 | |
|
36555
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
36545
diff
changeset
|
396 | pce = g_new0(PurpleProtocolChatEntry, 1); |
|
40087
a8c6a80325dc
Fix an accelerator in a string in libpurple. Accelerators are for UI's,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
39918
diff
changeset
|
397 | pce->label = _("Chat room"); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
398 | pce->identifier = "room"; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
399 | pce->required = TRUE; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
400 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
401 | return g_list_append(NULL, pce); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
402 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
403 | |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
404 | static GHashTable * |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
405 | null_chat_info_defaults(PurpleProtocolChat *protocol_chat, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
406 | PurpleConnection *gc, const gchar *room) |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
407 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
408 | GHashTable *defaults; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
409 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
410 | purple_debug_info("nullprpl", "returning chat default setting " |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
411 | "'room' = 'default'\n"); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
412 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
413 | defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
414 | g_hash_table_insert(defaults, "room", g_strdup("default")); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
415 | return defaults; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
416 | } |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
417 | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
418 | static void null_login(PurpleAccount *acct) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
419 | { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
420 | PurpleConnection *gc = purple_account_get_connection(acct); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
421 | GList *offline_messages; |
|
39918
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39896
diff
changeset
|
422 | GList *all_offline_messages; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
423 | |
|
32623
547eacef0b63
Convert libpurple and protocol prpl's to use the purple_account_* accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32618
diff
changeset
|
424 | purple_debug_info("nullprpl", "logging in %s\n", purple_account_get_username(acct)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
425 | |
|
36055
33978dc8ef6f
Remove redundant OPT_PROTO_IM_IMAGE (use \!PURPLE_CONNECTION_FLAG_NO_IMAGES instead)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35813
diff
changeset
|
426 | purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_NO_IMAGES); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
427 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
428 | purple_connection_update_progress(gc, _("Connecting"), |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
429 | 0, /* which connection step this is */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
430 | 2); /* total number of steps */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
431 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
432 | purple_connection_update_progress(gc, _("Connected"), |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
433 | 1, /* which connection step this is */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
434 | 2); /* total number of steps */ |
|
34746
dc9c911dbd35
Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
435 | purple_connection_set_state(gc, PURPLE_CONNECTION_CONNECTED); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
436 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
437 | /* tell purple about everyone on our buddy list who's connected */ |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
438 | foreach_null_gc(discover_status, gc, NULL); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
439 | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
440 | /* notify other nullprotocol accounts */ |
|
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
441 | foreach_null_gc(report_status_change, gc, NULL); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
442 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
443 | /* fetch stored offline messages */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
444 | purple_debug_info("nullprpl", "checking for offline messages for %s\n", |
|
32623
547eacef0b63
Convert libpurple and protocol prpl's to use the purple_account_* accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32618
diff
changeset
|
445 | purple_account_get_username(acct)); |
|
39918
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39896
diff
changeset
|
446 | all_offline_messages = offline_messages = g_hash_table_lookup( |
|
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39896
diff
changeset
|
447 | goffline_messages, purple_account_get_username(acct)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
448 | while (offline_messages) { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
449 | GOfflineMessage *message = (GOfflineMessage *)offline_messages->data; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
450 | purple_debug_info("nullprpl", "delivering offline message to %s: %s\n", |
|
32623
547eacef0b63
Convert libpurple and protocol prpl's to use the purple_account_* accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32618
diff
changeset
|
451 | purple_account_get_username(acct), message->message); |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
452 | purple_serv_got_im(gc, message->from, message->message, message->flags, |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
453 | message->mtime); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
454 | offline_messages = g_list_next(offline_messages); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
455 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
456 | g_free(message->from); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
457 | g_free(message->message); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
458 | g_free(message); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
459 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
460 | |
|
32623
547eacef0b63
Convert libpurple and protocol prpl's to use the purple_account_* accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32618
diff
changeset
|
461 | g_hash_table_remove(goffline_messages, purple_account_get_username(acct)); |
|
39918
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39896
diff
changeset
|
462 | g_list_free(all_offline_messages); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
463 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
464 | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
465 | static void null_close(PurpleConnection *gc) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
466 | { |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
467 | /* notify other nullprotocol accounts */ |
|
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
468 | foreach_null_gc(report_status_change, gc, NULL); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
469 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
470 | |
|
40507
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
471 | static int null_send_im(PurpleProtocolIM *im, PurpleConnection *gc, |
|
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
472 | PurpleMessage *msg) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
473 | { |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
474 | const char *from_username = purple_account_get_username(purple_connection_get_account(gc)); |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36084
diff
changeset
|
475 | const gchar *who = purple_message_get_recipient(msg); |
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
476 | PurpleMessageFlags receive_flags; |
|
41206
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
477 | PurpleAccountManager *manager = NULL; |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
478 | PurpleAccount *to_acct = NULL; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
479 | PurpleConnection *to; |
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
480 | const gchar *message = purple_message_get_contents(msg); |
|
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
481 | |
|
41206
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
482 | manager = purple_account_manager_get_default(); |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
483 | to_acct = purple_account_manager_find(manager, who, "null"); |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
484 | |
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
485 | receive_flags = ((purple_message_get_flags(msg) & ~PURPLE_MESSAGE_SEND) | PURPLE_MESSAGE_RECV); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
486 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
487 | purple_debug_info("nullprpl", "sending message from %s to %s: %s\n", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
488 | from_username, who, message); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
489 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
490 | /* is the sender blocked by the recipient's privacy settings? */ |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
491 | if (to_acct && |
|
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
492 | !purple_account_privacy_check(to_acct, purple_account_get_username(purple_connection_get_account(gc)))) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
493 | char *msg = g_strdup_printf( |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
494 | _("Your message was blocked by %s's privacy settings."), who); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
495 | purple_debug_info("nullprpl", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
496 | "discarding; %s is blocked by %s's privacy settings\n", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
497 | from_username, who); |
|
34868
faa5b053f310
Replaced purple_conversation_helper_present_error() with simpler purple_conversation_present_error()
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
498 | purple_conversation_present_error(who, purple_connection_get_account(gc), msg); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
499 | g_free(msg); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
500 | return 0; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
501 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
502 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
503 | /* is the recipient online? */ |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
504 | to = get_null_gc(who); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
505 | if (to) { /* yes, send */ |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
506 | purple_serv_got_im(to, from_username, message, receive_flags, time(NULL)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
507 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
508 | } else { /* nope, store as an offline message */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
509 | GOfflineMessage *offline_message; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
510 | GList *messages; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
511 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
512 | purple_debug_info("nullprpl", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
513 | "%s is offline, sending as offline message\n", who); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
514 | offline_message = g_new0(GOfflineMessage, 1); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
515 | offline_message->from = g_strdup(from_username); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
516 | offline_message->message = g_strdup(message); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
517 | offline_message->mtime = time(NULL); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
518 | offline_message->flags = receive_flags; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
519 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
520 | messages = g_hash_table_lookup(goffline_messages, who); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
521 | messages = g_list_append(messages, offline_message); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
522 | g_hash_table_insert(goffline_messages, g_strdup(who), messages); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
523 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
524 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
525 | return 1; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
526 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
527 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
528 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
529 | null_set_info(PurpleProtocolServer *protocol_server, PurpleConnection *gc, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
530 | const gchar *info) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
531 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
532 | purple_debug_info("nullprpl", "setting %s's user info to %s\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
533 | purple_account_get_username(purple_connection_get_account(gc)), info); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
534 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
535 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34631
diff
changeset
|
536 | static const char *typing_state_to_string(PurpleIMTypingState typing) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
537 | switch (typing) { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34631
diff
changeset
|
538 | case PURPLE_IM_NOT_TYPING: return "is not typing"; |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34631
diff
changeset
|
539 | case PURPLE_IM_TYPING: return "is typing"; |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34631
diff
changeset
|
540 | case PURPLE_IM_TYPED: return "stopped typing momentarily"; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
541 | default: return "unknown typing state"; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
542 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
543 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
544 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
545 | static void notify_typing(PurpleConnection *from, PurpleConnection *to, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
546 | gpointer typing) { |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
547 | const char *from_username = purple_account_get_username(purple_connection_get_account(from)); |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34631
diff
changeset
|
548 | const char *action = typing_state_to_string((PurpleIMTypingState)typing); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
549 | purple_debug_info("nullprpl", "notifying %s that %s %s\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
550 | purple_account_get_username(purple_connection_get_account(to)), from_username, action); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
551 | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
552 | purple_serv_got_typing(to, |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
553 | from_username, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
554 | 0, /* if non-zero, a timeout in seconds after which to |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34631
diff
changeset
|
555 | * reset the typing status to PURPLE_IM_NOT_TYPING */ |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34631
diff
changeset
|
556 | (PurpleIMTypingState)typing); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
557 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
558 | |
|
40507
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
559 | static unsigned int null_send_typing(PurpleProtocolIM *im, |
|
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
560 | PurpleConnection *gc, const char *name, |
|
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
561 | PurpleIMTypingState typing) |
|
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
562 | { |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
563 | purple_debug_info("nullprpl", "%s %s\n", purple_account_get_username(purple_connection_get_account(gc)), |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
564 | typing_state_to_string(typing)); |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
565 | foreach_null_gc(notify_typing, gc, (gpointer)typing); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
566 | return 0; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
567 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
568 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
569 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
570 | null_get_info(PurpleProtocolServer *protocol_server, PurpleConnection *gc, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
571 | const gchar *username) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
572 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
573 | const char *body; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
574 | PurpleNotifyUserInfo *info = purple_notify_user_info_new(); |
|
41206
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
575 | PurpleAccountManager *manager = NULL; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
576 | PurpleAccount *acct; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
577 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
578 | purple_debug_info("nullprpl", "Fetching %s's user info for %s\n", username, |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
579 | purple_account_get_username(purple_connection_get_account(gc))); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
580 | |
|
41206
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
581 | manager = purple_account_manager_get_default(); |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
582 | acct = purple_account_manager_find(manager, username, "null"); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
583 | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
584 | if (!get_null_gc(username)) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
585 | char *msg = g_strdup_printf(_("%s is not logged in."), username); |
| 34977 | 586 | purple_notify_error(gc, _("User Info"), _("User info not available. "), msg, |
| 34979 | 587 | purple_request_cpar_from_account(acct)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
588 | g_free(msg); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
589 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
590 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
591 | if (acct) |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
592 | body = purple_account_get_user_info(acct); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
593 | else |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
594 | body = _("No user info."); |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
31595
diff
changeset
|
595 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
31595
diff
changeset
|
596 | or if we should be using add_pair_plaintext */ |
|
32263
02baf4631f3b
Update nullprpl for various API changes.
Andrew Victor <andrew.victor@mxit.com>
parents:
32190
diff
changeset
|
597 | purple_notify_user_info_add_pair_html(info, "Info", body); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
598 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
599 | /* show a buddy's user info in a nice dialog box */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
600 | purple_notify_userinfo(gc, /* connection the buddy info came through */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
601 | username, /* buddy's username */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
602 | info, /* body */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
603 | NULL, /* callback called when dialog closed */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
604 | NULL); /* userdata for callback */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
605 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
606 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
607 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
608 | null_set_status(PurpleProtocolServer *protocol_server, PurpleAccount *acct, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
609 | PurpleStatus *status) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
610 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
611 | const char *msg = purple_status_get_attr_string(status, "message"); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
612 | purple_debug_info("nullprpl", "setting %s's status to %s: %s\n", |
|
32623
547eacef0b63
Convert libpurple and protocol prpl's to use the purple_account_* accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32618
diff
changeset
|
613 | purple_account_get_username(acct), purple_status_get_name(status), msg); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
614 | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
615 | foreach_null_gc(report_status_change, get_null_gc(purple_account_get_username(acct)), |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
616 | NULL); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
617 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
618 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
619 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
620 | null_set_idle(PurpleProtocolServer *protocol_server, PurpleConnection *gc, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
621 | gint idletime) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
622 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
623 | purple_debug_info("nullprpl", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
624 | "purple reports that %s has been idle for %d seconds\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
625 | purple_account_get_username(purple_connection_get_account(gc)), idletime); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
626 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
627 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
628 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
629 | null_change_passwd(PurpleProtocolServer *protocol_server, PurpleConnection *gc, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
630 | const gchar *old_pass, const gchar *new_pass) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
631 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
632 | purple_debug_info("nullprpl", "%s wants to change their password\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
633 | purple_account_get_username(purple_connection_get_account(gc))); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
634 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
635 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
636 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
637 | null_add_buddy(PurpleProtocolServer *protocol_server, PurpleConnection *gc, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
638 | PurpleBuddy *buddy, PurpleGroup *group, const gchar *message) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
639 | { |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
640 | const char *username = purple_account_get_username(purple_connection_get_account(gc)); |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
641 | PurpleConnection *buddy_gc = get_null_gc(purple_buddy_get_name(buddy)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
642 | |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
643 | purple_debug_info("nullprpl", "adding %s to %s's buddy list\n", purple_buddy_get_name(buddy), |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
644 | username); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
645 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
646 | if (buddy_gc) { |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
647 | PurpleAccount *buddy_acct = purple_connection_get_account(buddy_gc); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
648 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
649 | discover_status(gc, buddy_gc, NULL); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
650 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34706
diff
changeset
|
651 | if (purple_blist_find_buddy(buddy_acct, username)) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
652 | purple_debug_info("nullprpl", "%s is already on %s's buddy list\n", |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
653 | username, purple_buddy_get_name(buddy)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
654 | } else { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
655 | purple_debug_info("nullprpl", "asking %s if they want to add %s\n", |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
656 | purple_buddy_get_name(buddy), username); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
657 | purple_account_request_add(buddy_acct, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
658 | username, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
659 | NULL, /* local account id (rarely used) */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
660 | NULL, /* alias */ |
|
32315
2550a39e0285
Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32263
diff
changeset
|
661 | message); /* message */ |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
662 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
663 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
664 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
665 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
666 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
667 | null_add_buddies(PurpleProtocolServer *protocol_server, PurpleConnection *gc, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
668 | GList *buddies, GList *groups, const gchar *message) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
669 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
670 | GList *buddy = buddies; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
671 | GList *group = groups; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
672 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
673 | purple_debug_info("nullprpl", "adding multiple buddies\n"); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
674 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
675 | while (buddy && group) { |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
676 | null_add_buddy(protocol_server, gc, PURPLE_BUDDY(buddy->data), |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
677 | PURPLE_GROUP(group->data), message); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
678 | buddy = g_list_next(buddy); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
679 | group = g_list_next(group); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
680 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
681 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
682 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
683 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
684 | null_remove_buddy(PurpleProtocolServer *protocol_server, PurpleConnection *gc, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
685 | PurpleBuddy *buddy, PurpleGroup *group) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
686 | { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
687 | purple_debug_info("nullprpl", "removing %s from %s's buddy list\n", |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
688 | purple_buddy_get_name(buddy), |
|
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
689 | purple_account_get_username(purple_connection_get_account(gc))); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
690 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
691 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
692 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
693 | null_remove_buddies(PurpleProtocolServer *protocol_server, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
694 | PurpleConnection *gc, GList *buddies, GList *groups) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
695 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
696 | GList *buddy = buddies; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
697 | GList *group = groups; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
698 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
699 | purple_debug_info("nullprpl", "removing multiple buddies\n"); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
700 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
701 | while (buddy && group) { |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
702 | null_remove_buddy(protocol_server, gc, PURPLE_BUDDY(buddy->data), |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
703 | PURPLE_GROUP(group->data)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
704 | buddy = g_list_next(buddy); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
705 | group = g_list_next(group); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
706 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
707 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
708 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
709 | /* |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
710 | * nullprotocol uses purple's local whitelist and blacklist, stored in blist.xml, as |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
711 | * its authoritative privacy settings, and uses purple's logic (specifically |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
712 | * purple_privacy_check(), from privacy.h), to determine whether messages are |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
713 | * allowed or blocked. |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
714 | */ |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
715 | static void null_add_permit(PurpleProtocolPrivacy *privacy, |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
716 | PurpleConnection *gc, const char *name) |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
717 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
718 | purple_debug_info("nullprpl", "%s adds %s to their allowed list\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
719 | purple_account_get_username(purple_connection_get_account(gc)), name); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
720 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
721 | |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
722 | static void null_add_deny(PurpleProtocolPrivacy *privacy, |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
723 | PurpleConnection *gc, const char *name) |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
724 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
725 | purple_debug_info("nullprpl", "%s adds %s to their blocked list\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
726 | purple_account_get_username(purple_connection_get_account(gc)), name); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
727 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
728 | |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
729 | static void null_remove_permit(PurpleProtocolPrivacy *privacy, |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
730 | PurpleConnection *gc, const char *name) |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
731 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
732 | purple_debug_info("nullprpl", "%s removes %s from their allowed list\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
733 | purple_account_get_username(purple_connection_get_account(gc)), name); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
734 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
735 | |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
736 | static void null_remove_deny(PurpleProtocolPrivacy *privacy, |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
737 | PurpleConnection *gc, const char *name) |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
738 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
739 | purple_debug_info("nullprpl", "%s removes %s from their blocked list\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
740 | purple_account_get_username(purple_connection_get_account(gc)), name); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
741 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
742 | |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
743 | static void null_set_permit_deny(PurpleProtocolPrivacy *privacy, PurpleConnection *gc) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
744 | /* this is for synchronizing the local black/whitelist with the server. |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
745 | * for nullprotocol, it's a noop. |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
746 | */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
747 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
748 | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
749 | static void joined_chat(PurpleConversation *from, PurpleConversation *to, |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
750 | int id, const char *room, gpointer userdata) { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
751 | /* tell their chat window that we joined */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
752 | purple_debug_info("nullprpl", "%s sees that %s joined chat room %s\n", |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
753 | purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(to)), purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), room); |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
754 | purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(to), |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
755 | purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
756 | NULL, /* user-provided join message, IRC style */ |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34631
diff
changeset
|
757 | PURPLE_CHAT_USER_NONE, |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
758 | TRUE); /* show a join message */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
759 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
760 | if (from != to) { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
761 | /* add them to our chat window */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
762 | purple_debug_info("nullprpl", "%s sees that %s is in chat room %s\n", |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
763 | purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(to)), room); |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
764 | purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(from), |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
765 | purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(to)), |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
766 | NULL, /* user-provided join message, IRC style */ |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34631
diff
changeset
|
767 | PURPLE_CHAT_USER_NONE, |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
768 | FALSE); /* show a join message */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
769 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
770 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
771 | |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
772 | static void |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
773 | null_join_chat(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
774 | GHashTable *components) |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
775 | { |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
776 | PurpleAccount *account = purple_connection_get_account(gc); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
777 | PurpleConversationManager *manager; |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
778 | const char *username = purple_account_get_username(account); |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
779 | const char *room = g_hash_table_lookup(components, "room"); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
780 | int chat_id = g_str_hash(room); |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
781 | |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
782 | purple_debug_info("nullprpl", "%s is joining chat room %s\n", username, room); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
783 | |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
784 | manager = purple_conversation_manager_get_default(); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
785 | |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
786 | if(!purple_conversation_manager_find_chat_by_id(manager, account, chat_id)) { |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
787 | purple_serv_got_joined_chat(gc, chat_id, room); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
788 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
789 | /* tell everyone that we joined, and add them if they're already there */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
790 | foreach_gc_in_chat(joined_chat, gc, chat_id, NULL); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
791 | } else { |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
792 | char *tmp = g_strdup_printf(_("%s is already in chat room %s."), |
|
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
793 | username, |
|
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
794 | room); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
795 | purple_debug_info("nullprpl", "%s is already in chat room %s\n", username, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
796 | room); |
| 34977 | 797 | purple_notify_info(gc, _("Join chat"), _("Join chat"), tmp, |
| 34979 | 798 | purple_request_cpar_from_connection(gc)); |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
799 | g_free(tmp); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
800 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
801 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
802 | |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
803 | static void |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
804 | null_reject_chat(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
805 | GHashTable *components) |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
806 | { |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
807 | const char *invited_by = g_hash_table_lookup(components, "invited_by"); |
|
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
808 | const char *room = g_hash_table_lookup(components, "room"); |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
809 | const char *username = purple_account_get_username(purple_connection_get_account(gc)); |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
810 | PurpleConnection *invited_by_gc = get_null_gc(invited_by); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
811 | char *message = g_strdup_printf( |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
812 | "%s %s %s.", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
813 | username, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
814 | _("has rejected your invitation to join the chat room"), |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
815 | room); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
816 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
817 | purple_debug_info("nullprpl", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
818 | "%s has rejected %s's invitation to join chat room %s\n", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
819 | username, invited_by, room); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
820 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
821 | purple_notify_info(invited_by_gc, |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
822 | _("Chat invitation rejected"), |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
823 | _("Chat invitation rejected"), |
| 34977 | 824 | message, |
| 34979 | 825 | purple_request_cpar_from_connection(gc)); |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
826 | g_free(message); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
827 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
828 | |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
829 | static gchar * |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
830 | null_get_chat_name(PurpleProtocolChat *protocol_chat, GHashTable *components) { |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
831 | const char *room = g_hash_table_lookup(components, "room"); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
832 | purple_debug_info("nullprpl", "reporting chat room name '%s'\n", room); |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
833 | return g_strdup(room); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
834 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
835 | |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
836 | static void |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
837 | null_chat_invite(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
838 | gint id, const gchar *message, const gchar *who) |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
839 | { |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
840 | PurpleAccount *account = purple_connection_get_account(gc); |
|
41206
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
841 | PurpleAccount *to_acct = NULL; |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
842 | PurpleAccountManager *account_manager = NULL; |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
843 | PurpleConversation *chat; |
|
41206
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
844 | PurpleConversationManager *conversation_manager; |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
845 | const char *username = purple_account_get_username(account); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
846 | const char *room = NULL; |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
847 | |
|
41206
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
848 | account_manager = purple_account_manager_get_default(); |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
849 | to_acct = purple_account_manager_find(account_manager, who, "null"); |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
850 | |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
851 | conversation_manager = purple_conversation_manager_get_default(); |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
852 | chat = purple_conversation_manager_find_chat_by_id(conversation_manager, |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
853 | account, id); |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
854 | room = purple_conversation_get_name(chat); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
855 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
856 | purple_debug_info("nullprpl", "%s is inviting %s to join chat room %s\n", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
857 | username, who, room); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
858 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
859 | if (to_acct) { |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
860 | PurpleConversation *to_conv; |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
861 | |
|
41206
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
862 | to_conv = purple_conversation_manager_find_chat_by_id(conversation_manager, |
|
afcae29ce67e
Port libpurple plugins and protocols to the AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
863 | to_acct, id); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
864 | if (to_conv) { |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
865 | char *tmp = g_strdup_printf("%s is already in chat room %s.", who, room); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
866 | purple_debug_info("nullprpl", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
867 | "%s is already in chat room %s; " |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
868 | "ignoring invitation from %s\n", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
869 | who, room, username); |
| 34977 | 870 | purple_notify_info(gc, _("Chat invitation"), _("Chat invitation"), tmp, |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
871 | purple_request_cpar_from_conversation(to_conv)); |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
872 | g_free(tmp); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
873 | } else { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
874 | GHashTable *components; |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
875 | components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
876 | g_hash_table_replace(components, "room", g_strdup(room)); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
877 | g_hash_table_replace(components, "invited_by", g_strdup(username)); |
| 35501 | 878 | purple_serv_got_chat_invite(purple_account_get_connection(to_acct), room, username, message, components); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
879 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
880 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
881 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
882 | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
883 | static void left_chat_room(PurpleConversation *from, PurpleConversation *to, |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
884 | int id, const char *room, gpointer userdata) { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
885 | if (from != to) { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
886 | /* tell their chat window that we left */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
887 | purple_debug_info("nullprpl", "%s sees that %s left chat room %s\n", |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
888 | purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(to)), purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), room); |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
889 | purple_chat_conversation_remove_user(PURPLE_CHAT_CONVERSATION(to), |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
890 | purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
891 | NULL); /* user-provided message, IRC style */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
892 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
893 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
894 | |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
895 | static void |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
896 | null_chat_leave(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
897 | gint id) |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
898 | { |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
899 | PurpleConversationManager *manager; |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
900 | PurpleConversation *chat; |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
901 | |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
902 | manager = purple_conversation_manager_get_default(); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
903 | chat = purple_conversation_manager_find_chat_by_id(manager, |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
904 | purple_connection_get_account(gc), |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
905 | id); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
906 | purple_debug_info("nullprpl", "%s is leaving chat room %s\n", |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
907 | purple_account_get_username(purple_connection_get_account(gc)), |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
908 | purple_conversation_get_name(chat)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
909 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
910 | /* tell everyone that we left */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
911 | foreach_gc_in_chat(left_chat_room, gc, id, NULL); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
912 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
913 | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
914 | static void receive_chat_message(PurpleConversation *from, PurpleConversation *to, |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
915 | int id, const char *room, gpointer userdata) { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
916 | const char *message = (const char *)userdata; |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
917 | PurpleConnection *to_gc = get_null_gc(purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(to))); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
918 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
919 | purple_debug_info("nullprpl", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
920 | "%s receives message from %s in chat room %s: %s\n", |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
921 | purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(to)), purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), room, message); |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
922 | purple_serv_got_chat_in(to_gc, id, purple_chat_conversation_get_nick(PURPLE_CHAT_CONVERSATION(from)), PURPLE_MESSAGE_RECV, message, |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
923 | time(NULL)); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
924 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
925 | |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
926 | static gint |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
927 | null_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
928 | gint id, PurpleMessage *msg) |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
929 | { |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
930 | PurpleAccount *account = purple_connection_get_account(gc); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
931 | PurpleConversation *chat; |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
932 | PurpleConversationManager *manager; |
|
36077
b7328f4317c7
Switch purple_serv_chat_send to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36076
diff
changeset
|
933 | const gchar *message = purple_message_get_contents(msg); |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
934 | const gchar *username = purple_account_get_username(account); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
935 | |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
936 | manager = purple_conversation_manager_get_default(); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
937 | chat = purple_conversation_manager_find_chat_by_id(manager, account, id); |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
938 | if (chat) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
939 | purple_debug_info("nullprpl", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
940 | "%s is sending message to chat room %s: %s\n", username, |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
941 | purple_conversation_get_name(chat), message); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
942 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
943 | /* send message to everyone in the chat room */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
944 | foreach_gc_in_chat(receive_chat_message, gc, id, (gpointer)message); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
945 | return 0; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
946 | } else { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
947 | purple_debug_info("nullprpl", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
948 | "tried to send message from %s to chat room #%d: %s\n" |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
949 | "but couldn't find chat room", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
950 | username, id, message); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
951 | return -1; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
952 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
953 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
954 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
955 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
956 | null_register_user(PurpleProtocolServer *protocol_server, PurpleAccount *acct) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
957 | purple_debug_info("nullprpl", "registering account for %s\n", |
|
32623
547eacef0b63
Convert libpurple and protocol prpl's to use the purple_account_* accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32618
diff
changeset
|
958 | purple_account_get_username(acct)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
959 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
960 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
961 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
962 | null_alias_buddy(PurpleProtocolServer *protocol_server, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
963 | PurpleConnection *gc, const gchar *who, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
964 | const gchar *alias) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
965 | { |
|
22709
6bd336964410
Printf warning fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
966 | purple_debug_info("nullprpl", "%s sets %s's alias to %s\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
967 | purple_account_get_username(purple_connection_get_account(gc)), who, alias); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
968 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
969 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
970 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
971 | null_group_buddy(PurpleProtocolServer *protocol_server, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
972 | PurpleConnection *gc, const gchar *who, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
973 | const gchar *old_group, const gchar *new_group) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
974 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
975 | purple_debug_info("nullprpl", "%s has moved %s from group %s to group %s\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
976 | purple_account_get_username(purple_connection_get_account(gc)), who, old_group, new_group); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
977 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
978 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
979 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
980 | null_rename_group(PurpleProtocolServer *protocol_server, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
981 | PurpleConnection *gc, const gchar *old_name, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
982 | PurpleGroup *group, GList *moved_buddies) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
983 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
984 | purple_debug_info("nullprpl", "%s has renamed group %s to %s\n", |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
985 | purple_account_get_username(purple_connection_get_account(gc)), old_name, |
|
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
986 | purple_group_get_name(group)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
987 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
988 | |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
989 | static void |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
990 | null_convo_closed(PurpleProtocolClient *client, PurpleConnection *gc, |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
991 | const char *who) |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
992 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
993 | purple_debug_info("nullprpl", "%s's conversation with %s was closed\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
994 | purple_account_get_username(purple_connection_get_account(gc)), who); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
995 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
996 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
997 | /* normalize a username (e.g. remove whitespace, add default domain, etc.) |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
998 | * for nullprotocol, this is a noop. |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
999 | */ |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
1000 | static const char * |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
1001 | null_normalize(PurpleProtocolClient *client, PurpleAccount *acct, |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
1002 | const char *input) |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
1003 | { |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
1004 | return input; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1005 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1006 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
1007 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
1008 | null_set_buddy_icon(PurpleProtocolServer *protocol_server, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
1009 | PurpleConnection *gc, PurpleImage *img) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
1010 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1011 | purple_debug_info("nullprpl", "setting %s's buddy icon to %s\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
1012 | purple_account_get_username(purple_connection_get_account(gc)), |
|
39877
4bc87b3dbca4
Get the null prpl working again and build it by default but don't install it
Gary Kramlich <grim@reaperworld.com>
parents:
39760
diff
changeset
|
1013 | img ? purple_image_get_path(img) : "(null)"); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1014 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1015 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
1016 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
1017 | null_remove_group(PurpleProtocolServer *protocol_server, PurpleConnection *gc, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
1018 | PurpleGroup *group) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40697
diff
changeset
|
1019 | { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1020 | purple_debug_info("nullprpl", "%s has removed group %s\n", |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
1021 | purple_account_get_username(purple_connection_get_account(gc)), |
|
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
1022 | purple_group_get_name(group)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1023 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1024 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1025 | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
1026 | static void set_chat_topic_fn(PurpleConversation *from, PurpleConversation *to, |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1027 | int id, const char *room, gpointer userdata) { |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1028 | const char *topic = (const char *)userdata; |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
1029 | const char *username = purple_account_get_username(purple_conversation_get_account(PURPLE_CONVERSATION(from))); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1030 | char *msg; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1031 | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
1032 | purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(to), username, topic); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1033 | |
|
32189
3af8d41121b6
Don't use strlen() when all you're trying to do is check if the string
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1034 | if (topic && *topic) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1035 | msg = g_strdup_printf(_("%s sets topic to: %s"), username, topic); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1036 | else |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1037 | msg = g_strdup_printf(_("%s clears topic"), username); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1038 | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
1039 | purple_conversation_write_system_message(to, msg, PURPLE_MESSAGE_NO_LOG); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1040 | g_free(msg); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1041 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1042 | |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
1043 | static void |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
1044 | null_set_chat_topic(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
1045 | gint id, const gchar *topic) |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
1046 | { |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
1047 | PurpleConversation *chat = NULL; |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
1048 | PurpleConversationManager *manager = NULL; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1049 | const char *last_topic; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1050 | |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
1051 | manager = purple_conversation_manager_get_default(); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
1052 | chat = purple_conversation_manager_find_chat_by_id(manager, |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
1053 | purple_connection_get_account(gc), |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
1054 | id); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
1055 | if (!chat) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1056 | return; |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
1057 | } |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1058 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1059 | purple_debug_info("nullprpl", "%s sets topic of chat room '%s' to '%s'\n", |
|
34872
3b6a783817b9
Refactored nullprpl to use the GObjectified purple API
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
1060 | purple_account_get_username(purple_connection_get_account(gc)), |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
1061 | purple_conversation_get_name(chat), topic); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1062 | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
1063 | last_topic = purple_chat_conversation_get_topic(PURPLE_CHAT_CONVERSATION(chat)); |
|
38266
7c1706b2bd11
Remove found redundant NULL checks
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
1064 | if (purple_strequal(topic, last_topic)) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1065 | return; /* topic is unchanged, this is a noop */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1066 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1067 | foreach_gc_in_chat(set_chat_topic_fn, gc, id, (gpointer)topic); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1068 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1069 | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1070 | static gboolean null_finish_get_roomlist(gpointer roomlist) { |
|
34991
63c14353a0f4
Manage refcounts in some libpurple callbacks
Ankit Vani <a@nevitus.org>
parents:
34979
diff
changeset
|
1071 | purple_roomlist_set_in_progress(PURPLE_ROOMLIST(roomlist), FALSE); |
|
63c14353a0f4
Manage refcounts in some libpurple callbacks
Ankit Vani <a@nevitus.org>
parents:
34979
diff
changeset
|
1072 | g_object_unref(roomlist); |
|
63c14353a0f4
Manage refcounts in some libpurple callbacks
Ankit Vani <a@nevitus.org>
parents:
34979
diff
changeset
|
1073 | |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1074 | return FALSE; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1075 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1076 | |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1077 | static PurpleRoomlist * |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1078 | null_roomlist_get_list(PurpleProtocolRoomlist *protocol_roomlist, |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1079 | PurpleConnection *gc) |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1080 | { |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
1081 | const char *username = purple_account_get_username(purple_connection_get_account(gc)); |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
1082 | PurpleConversationManager *manager; |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
1083 | PurpleRoomlist *roomlist = purple_roomlist_new(purple_connection_get_account(gc)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1084 | GList *chats; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1085 | GList *seen_ids = NULL; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1086 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1087 | purple_debug_info("nullprpl", "%s asks for room list; returning:\n", username); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1088 | |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
1089 | manager = purple_conversation_manager_get_default(); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
1090 | |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1091 | /* add each chat room. the chat ids are cached in seen_ids so that each room |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1092 | * is only returned once, even if multiple users are in it. */ |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40948
diff
changeset
|
1093 | for (chats = purple_conversation_manager_get_all(manager); chats; chats = g_list_next(chats)) { |
|
40948
2c312f084d84
Create a manager for conversations.
Gary Kramlich <grim@reaperworld.com>
parents:
40945
diff
changeset
|
1094 | PurpleChatConversation *chat = NULL; |
|
2c312f084d84
Create a manager for conversations.
Gary Kramlich <grim@reaperworld.com>
parents:
40945
diff
changeset
|
1095 | PurpleRoomlistRoom *room = NULL; |
|
2c312f084d84
Create a manager for conversations.
Gary Kramlich <grim@reaperworld.com>
parents:
40945
diff
changeset
|
1096 | const gchar *name = NULL; |
|
2c312f084d84
Create a manager for conversations.
Gary Kramlich <grim@reaperworld.com>
parents:
40945
diff
changeset
|
1097 | gint id = 0; |
|
2c312f084d84
Create a manager for conversations.
Gary Kramlich <grim@reaperworld.com>
parents:
40945
diff
changeset
|
1098 | |
|
2c312f084d84
Create a manager for conversations.
Gary Kramlich <grim@reaperworld.com>
parents:
40945
diff
changeset
|
1099 | if(!PURPLE_IS_CHAT_CONVERSATION(chats->data)) { |
|
2c312f084d84
Create a manager for conversations.
Gary Kramlich <grim@reaperworld.com>
parents:
40945
diff
changeset
|
1100 | continue; |
|
2c312f084d84
Create a manager for conversations.
Gary Kramlich <grim@reaperworld.com>
parents:
40945
diff
changeset
|
1101 | } |
|
2c312f084d84
Create a manager for conversations.
Gary Kramlich <grim@reaperworld.com>
parents:
40945
diff
changeset
|
1102 | |
|
2c312f084d84
Create a manager for conversations.
Gary Kramlich <grim@reaperworld.com>
parents:
40945
diff
changeset
|
1103 | chat = PURPLE_CHAT_CONVERSATION(chats->data); |
|
2c312f084d84
Create a manager for conversations.
Gary Kramlich <grim@reaperworld.com>
parents:
40945
diff
changeset
|
1104 | name = purple_conversation_get_name(PURPLE_CONVERSATION(chat)); |
|
2c312f084d84
Create a manager for conversations.
Gary Kramlich <grim@reaperworld.com>
parents:
40945
diff
changeset
|
1105 | id = purple_chat_conversation_get_id(chat); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1106 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1107 | /* have we already added this room? */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1108 | if (g_list_find_custom(seen_ids, name, (GCompareFunc)strcmp)) |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1109 | continue; /* yes! try the next one. */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1110 | |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
1111 | /* This cast is OK because this list is only staying around for the life |
|
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
1112 | * of this function and none of the conversations are being deleted |
| 29977 | 1113 | * in that timespan. */ |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
1114 | seen_ids = g_list_prepend(seen_ids, (char *)name); /* no, it's new. */ |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1115 | purple_debug_info("nullprpl", "%s (%d), ", name, id); |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1116 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
1117 | room = purple_roomlist_room_new(name, NULL); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
1118 | purple_roomlist_room_add_field(room, "room", g_strdup(name)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1119 | purple_roomlist_room_add(roomlist, room); |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
1120 | g_object_unref(room); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1121 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1122 | |
|
24862
852378e0c5b5
Various nullprpl fixes. This stemmed from a complaint from a user in
Paul Aurich <darkrain42@pidgin.im>
parents:
24332
diff
changeset
|
1123 | g_list_free(seen_ids); |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
1124 | g_timeout_add(1 /* ms */, null_finish_get_roomlist, g_object_ref(roomlist)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1125 | return roomlist; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1126 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1127 | |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1128 | static void |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1129 | null_roomlist_cancel(PurpleProtocolRoomlist *protocol_roomlist, |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1130 | PurpleRoomlist *list) |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1131 | { |
|
32263
02baf4631f3b
Update nullprpl for various API changes.
Andrew Victor <andrew.victor@mxit.com>
parents:
32190
diff
changeset
|
1132 | PurpleAccount *account = purple_roomlist_get_account(list); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1133 | purple_debug_info("nullprpl", "%s asked to cancel room list request\n", |
|
32263
02baf4631f3b
Update nullprpl for various API changes.
Andrew Victor <andrew.victor@mxit.com>
parents:
32190
diff
changeset
|
1134 | purple_account_get_username(account)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1135 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1136 | |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1137 | static void |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1138 | null_roomlist_expand_category(PurpleProtocolRoomlist *protocol_roomlist, |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1139 | PurpleRoomlist *list, |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1140 | PurpleRoomlistRoom *category) |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1141 | { |
|
32263
02baf4631f3b
Update nullprpl for various API changes.
Andrew Victor <andrew.victor@mxit.com>
parents:
32190
diff
changeset
|
1142 | PurpleAccount *account = purple_roomlist_get_account(list); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1143 | purple_debug_info("nullprpl", "%s asked to expand room list category %s\n", |
|
32263
02baf4631f3b
Update nullprpl for various API changes.
Andrew Victor <andrew.victor@mxit.com>
parents:
32190
diff
changeset
|
1144 | purple_account_get_username(account), |
|
02baf4631f3b
Update nullprpl for various API changes.
Andrew Victor <andrew.victor@mxit.com>
parents:
32190
diff
changeset
|
1145 | purple_roomlist_room_get_name(category)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1146 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1147 | |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
1148 | static gboolean |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
1149 | null_offline_message(PurpleProtocolClient *client, PurpleBuddy *buddy) { |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1150 | purple_debug_info("nullprpl", |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1151 | "reporting that offline messages are supported for %s\n", |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
1152 | purple_buddy_get_name(buddy)); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1153 | return TRUE; |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1154 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1155 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1156 | /* |
|
36683
852cb2830a0a
Refactor nullprotocol to use instance init
Ankit Vani <a@nevitus.org>
parents:
36679
diff
changeset
|
1157 | * Initialize the protocol instance. see protocol.h for more information. |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1158 | */ |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1159 | static void |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1160 | null_protocol_init(NullProtocol *self) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1161 | { |
|
36683
852cb2830a0a
Refactor nullprotocol to use instance init
Ankit Vani <a@nevitus.org>
parents:
36679
diff
changeset
|
1162 | } |
|
852cb2830a0a
Refactor nullprotocol to use instance init
Ankit Vani <a@nevitus.org>
parents:
36679
diff
changeset
|
1163 | |
|
852cb2830a0a
Refactor nullprotocol to use instance init
Ankit Vani <a@nevitus.org>
parents:
36679
diff
changeset
|
1164 | /* |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1165 | * Initialize the protocol class and interfaces. |
|
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1166 | * see protocol.h for more information. |
|
36683
852cb2830a0a
Refactor nullprotocol to use instance init
Ankit Vani <a@nevitus.org>
parents:
36679
diff
changeset
|
1167 | */ |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1168 | |
|
36683
852cb2830a0a
Refactor nullprotocol to use instance init
Ankit Vani <a@nevitus.org>
parents:
36679
diff
changeset
|
1169 | static void |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1170 | null_protocol_class_init(NullProtocolClass *klass) |
|
36683
852cb2830a0a
Refactor nullprotocol to use instance init
Ankit Vani <a@nevitus.org>
parents:
36679
diff
changeset
|
1171 | { |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1172 | PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass); |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1173 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1174 | protocol_class->login = null_login; |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1175 | protocol_class->close = null_close; |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1176 | protocol_class->status_types = null_status_types; |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1177 | protocol_class->list_icon = null_list_icon; |
|
40813
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1178 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1179 | protocol_class->get_account_options = null_protocol_get_account_options; |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1180 | protocol_class->get_buddy_icon_spec = null_protocol_get_buddy_icon_spec; |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1181 | protocol_class->get_user_splits = null_protocol_get_user_splits; |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1182 | } |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1183 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1184 | static void |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1185 | null_protocol_class_finalize(G_GNUC_UNUSED NullProtocolClass *klass) |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1186 | { |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1187 | } |
|
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1188 | |
|
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1189 | static void |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39483
diff
changeset
|
1190 | null_protocol_client_iface_init(PurpleProtocolClientInterface *client_iface) |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1191 | { |
| 36941 | 1192 | client_iface->get_actions = null_get_actions; |
| 1193 | client_iface->status_text = null_status_text; | |
| 1194 | client_iface->tooltip_text = null_tooltip_text; | |
| 1195 | client_iface->blist_node_menu = null_blist_node_menu; | |
| 1196 | client_iface->convo_closed = null_convo_closed; | |
| 1197 | client_iface->normalize = null_normalize; | |
| 1198 | client_iface->offline_message = null_offline_message; | |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1199 | } |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1200 | |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1201 | static void |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39483
diff
changeset
|
1202 | null_protocol_server_iface_init(PurpleProtocolServerInterface *server_iface) |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1203 | { |
| 36941 | 1204 | server_iface->register_user = null_register_user; |
| 1205 | server_iface->set_info = null_set_info; | |
| 1206 | server_iface->get_info = null_get_info; | |
| 1207 | server_iface->set_status = null_set_status; | |
| 1208 | server_iface->set_idle = null_set_idle; | |
| 1209 | server_iface->change_passwd = null_change_passwd; | |
| 1210 | server_iface->add_buddy = null_add_buddy; | |
| 1211 | server_iface->add_buddies = null_add_buddies; | |
| 1212 | server_iface->remove_buddy = null_remove_buddy; | |
| 1213 | server_iface->remove_buddies = null_remove_buddies; | |
| 1214 | server_iface->alias_buddy = null_alias_buddy; | |
| 1215 | server_iface->group_buddy = null_group_buddy; | |
| 1216 | server_iface->rename_group = null_rename_group; | |
| 1217 | server_iface->set_buddy_icon = null_set_buddy_icon; | |
| 1218 | server_iface->remove_group = null_remove_group; | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1219 | } |
|
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1220 | |
|
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1221 | static void |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39483
diff
changeset
|
1222 | null_protocol_im_iface_init(PurpleProtocolIMInterface *im_iface) |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1223 | { |
| 36941 | 1224 | im_iface->send = null_send_im; |
| 1225 | im_iface->send_typing = null_send_typing; | |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1226 | } |
|
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1227 | |
|
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1228 | static void |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39483
diff
changeset
|
1229 | null_protocol_chat_iface_init(PurpleProtocolChatInterface *chat_iface) |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1230 | { |
| 36941 | 1231 | chat_iface->info = null_chat_info; |
| 1232 | chat_iface->info_defaults = null_chat_info_defaults; | |
| 1233 | chat_iface->join = null_join_chat; | |
| 1234 | chat_iface->reject = null_reject_chat; | |
| 1235 | chat_iface->get_name = null_get_chat_name; | |
| 1236 | chat_iface->invite = null_chat_invite; | |
| 1237 | chat_iface->leave = null_chat_leave; | |
| 1238 | chat_iface->send = null_chat_send; | |
| 1239 | chat_iface->set_topic = null_set_chat_topic; | |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1240 | } |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1241 | |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1242 | static void |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39483
diff
changeset
|
1243 | null_protocol_privacy_iface_init(PurpleProtocolPrivacyInterface *privacy_iface) |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1244 | { |
| 36941 | 1245 | privacy_iface->add_permit = null_add_permit; |
| 1246 | privacy_iface->add_deny = null_add_deny; | |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
1247 | privacy_iface->remove_permit = null_remove_permit; |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
1248 | privacy_iface->remove_deny = null_remove_deny; |
| 36941 | 1249 | privacy_iface->set_permit_deny = null_set_permit_deny; |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1250 | } |
|
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1251 | |
|
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1252 | static void |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39483
diff
changeset
|
1253 | null_protocol_roomlist_iface_init(PurpleProtocolRoomlistInterface *roomlist_iface) |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1254 | { |
| 36941 | 1255 | roomlist_iface->get_list = null_roomlist_get_list; |
| 1256 | roomlist_iface->cancel = null_roomlist_cancel; | |
| 1257 | roomlist_iface->expand_category = null_roomlist_expand_category; | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1258 | } |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1259 | |
|
36700
6e948576476e
Refactored nullprotocol to use the new macro
Ankit Vani <a@nevitus.org>
parents:
36683
diff
changeset
|
1260 | /* |
|
6e948576476e
Refactored nullprotocol to use the new macro
Ankit Vani <a@nevitus.org>
parents:
36683
diff
changeset
|
1261 | * define the null protocol type. this macro defines |
|
6e948576476e
Refactored nullprotocol to use the new macro
Ankit Vani <a@nevitus.org>
parents:
36683
diff
changeset
|
1262 | * null_protocol_register_type(PurplePlugin *) which is called in plugin_load() |
|
6e948576476e
Refactored nullprotocol to use the new macro
Ankit Vani <a@nevitus.org>
parents:
36683
diff
changeset
|
1263 | * to register this type with the type system, and null_protocol_get_type() |
|
6e948576476e
Refactored nullprotocol to use the new macro
Ankit Vani <a@nevitus.org>
parents:
36683
diff
changeset
|
1264 | * which returns the registered GType. |
|
6e948576476e
Refactored nullprotocol to use the new macro
Ankit Vani <a@nevitus.org>
parents:
36683
diff
changeset
|
1265 | */ |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1266 | G_DEFINE_DYNAMIC_TYPE_EXTENDED( |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1267 | NullProtocol, null_protocol, PURPLE_TYPE_PROTOCOL, 0, |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1268 | |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1269 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_CLIENT, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1270 | null_protocol_client_iface_init) |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1271 | |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1272 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_SERVER, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1273 | null_protocol_server_iface_init) |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1274 | |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1275 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_IM, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1276 | null_protocol_im_iface_init) |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1277 | |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1278 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_CHAT, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1279 | null_protocol_chat_iface_init) |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1280 | |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1281 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_PRIVACY, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1282 | null_protocol_privacy_iface_init) |
|
36721
22db8c40260d
Refactored nullprotocol to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36700
diff
changeset
|
1283 | |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1284 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_ROOMLIST, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1285 | null_protocol_roomlist_iface_init)); |
|
36700
6e948576476e
Refactored nullprotocol to use the new macro
Ankit Vani <a@nevitus.org>
parents:
36683
diff
changeset
|
1286 | |
|
40813
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1287 | static PurpleProtocol * |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1288 | null_protocol_new(void) { |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1289 | return PURPLE_PROTOCOL(g_object_new( |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1290 | NULL_TYPE_PROTOCOL, |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1291 | "id", "prpl-null", |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1292 | "name", "Null - Testing Protocol", |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1293 | "options", OPT_PROTO_NO_PASSWORD | OPT_PROTO_CHAT_TOPIC, |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1294 | NULL)); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1295 | } |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1296 | |
|
40945
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
1297 | static GPluginPluginInfo * |
|
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
1298 | null_query(GError **error) |
|
36453
75bb4001a25f
Refactored nullprpl to build with the new plugin API. This is not final.
Ankit Vani <a@nevitus.org>
parents:
34872
diff
changeset
|
1299 | { |
|
75bb4001a25f
Refactored nullprpl to build with the new plugin API. This is not final.
Ankit Vani <a@nevitus.org>
parents:
34872
diff
changeset
|
1300 | return purple_plugin_info_new( |
|
36985
9faafe43603e
Rename protocol plugin IDs to prpl-*
Ankit Vani <a@nevitus.org>
parents:
36941
diff
changeset
|
1301 | "id", "prpl-null", |
|
36638
5f6dcd83e8c1
Seperate plugin and protocol IDs. Protocol ID example: "msn". Plugin ID example: "protocol-msn".
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
1302 | "name", "Null Protocol", |
|
36482
fbddfc86848d
Renamed purple-version to purple-abi. Removed abi-version from docs
Ankit Vani <a@nevitus.org>
parents:
36481
diff
changeset
|
1303 | "version", DISPLAY_VERSION, |
|
fbddfc86848d
Renamed purple-version to purple-abi. Removed abi-version from docs
Ankit Vani <a@nevitus.org>
parents:
36481
diff
changeset
|
1304 | "category", N_("Protocol"), |
|
fbddfc86848d
Renamed purple-version to purple-abi. Removed abi-version from docs
Ankit Vani <a@nevitus.org>
parents:
36481
diff
changeset
|
1305 | "summary", N_("Null Protocol Plugin"), |
|
fbddfc86848d
Renamed purple-version to purple-abi. Removed abi-version from docs
Ankit Vani <a@nevitus.org>
parents:
36481
diff
changeset
|
1306 | "description", N_("Null Protocol Plugin"), |
|
fbddfc86848d
Renamed purple-version to purple-abi. Removed abi-version from docs
Ankit Vani <a@nevitus.org>
parents:
36481
diff
changeset
|
1307 | "website", PURPLE_WEBSITE, |
|
36505
60c161851325
Integrated purple ABI requirement into GPlugin's "abi-version" property
Ankit Vani <a@nevitus.org>
parents:
36494
diff
changeset
|
1308 | "abi-version", PURPLE_ABI_VERSION, |
|
36467
52aa83c47311
Replaced purple_plugin_loads_on_query() with purple_plugin_is_internal().
Ankit Vani <a@nevitus.org>
parents:
36463
diff
changeset
|
1309 | |
|
37009
05ef6e29ea04
Rename nullprotocol back to nullprpl
Ankit Vani <a@nevitus.org>
parents:
36985
diff
changeset
|
1310 | /* If you're using this protocol plugin as the basis of a plugin that will |
|
05ef6e29ea04
Rename nullprotocol back to nullprpl
Ankit Vani <a@nevitus.org>
parents:
36985
diff
changeset
|
1311 | * be distributed separately from libpurple, do not include these flags. */ |
|
36653
4084c34c051d
Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
1312 | "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL | |
|
4084c34c051d
Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
1313 | PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD, |
|
36453
75bb4001a25f
Refactored nullprpl to build with the new plugin API. This is not final.
Ankit Vani <a@nevitus.org>
parents:
34872
diff
changeset
|
1314 | NULL |
|
75bb4001a25f
Refactored nullprpl to build with the new plugin API. This is not final.
Ankit Vani <a@nevitus.org>
parents:
34872
diff
changeset
|
1315 | ); |
|
75bb4001a25f
Refactored nullprpl to build with the new plugin API. This is not final.
Ankit Vani <a@nevitus.org>
parents:
34872
diff
changeset
|
1316 | } |
|
75bb4001a25f
Refactored nullprpl to build with the new plugin API. This is not final.
Ankit Vani <a@nevitus.org>
parents:
34872
diff
changeset
|
1317 | |
|
36458
a9cccad073e9
Static prpls now work. Added macro PURPLE_PLUGIN_INIT(plugin-name, query-func, load-func, unload-func).
Ankit Vani <a@nevitus.org>
parents:
36457
diff
changeset
|
1318 | static gboolean |
|
40945
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
1319 | null_load(GPluginPlugin *plugin, GError **error) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1320 | { |
|
40800
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
1321 | PurpleProtocolManager *manager = purple_protocol_manager_get_default(); |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
1322 | |
|
36700
6e948576476e
Refactored nullprotocol to use the new macro
Ankit Vani <a@nevitus.org>
parents:
36683
diff
changeset
|
1323 | /* register the NULL_TYPE_PROTOCOL type in the type system. this function |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1324 | * is defined by G_DEFINE_DYNAMIC_TYPE_EXTENDED. */ |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1325 | null_protocol_register_type(G_TYPE_MODULE(plugin)); |
|
36700
6e948576476e
Refactored nullprotocol to use the new macro
Ankit Vani <a@nevitus.org>
parents:
36683
diff
changeset
|
1326 | |
|
36677
081733748bbc
Only initialize/finalize protocol class data in *_base_init/finalize for protocols.
Ankit Vani <a@nevitus.org>
parents:
36664
diff
changeset
|
1327 | /* add the protocol to the core */ |
|
40813
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40800
diff
changeset
|
1328 | my_protocol = null_protocol_new(); |
|
40800
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
1329 | if(!purple_protocol_manager_register(manager, my_protocol, error)) { |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
1330 | g_clear_object(&my_protocol); |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
1331 | |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1332 | return FALSE; |
|
40800
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
1333 | } |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1334 | |
|
37009
05ef6e29ea04
Rename nullprotocol back to nullprpl
Ankit Vani <a@nevitus.org>
parents:
36985
diff
changeset
|
1335 | purple_debug_info("nullprpl", "starting up\n"); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1336 | |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1337 | /* get ready to store offline messages */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1338 | goffline_messages = g_hash_table_new_full(g_str_hash, /* hash fn */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1339 | g_str_equal, /* key comparison fn */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1340 | g_free, /* key free fn */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1341 | NULL); /* value free fn */ |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1342 | |
|
36453
75bb4001a25f
Refactored nullprpl to build with the new plugin API. This is not final.
Ankit Vani <a@nevitus.org>
parents:
34872
diff
changeset
|
1343 | return TRUE; |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1344 | } |
|
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1345 | |
|
36458
a9cccad073e9
Static prpls now work. Added macro PURPLE_PLUGIN_INIT(plugin-name, query-func, load-func, unload-func).
Ankit Vani <a@nevitus.org>
parents:
36457
diff
changeset
|
1346 | static gboolean |
|
41078
84e48180ef67
Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents:
41028
diff
changeset
|
1347 | null_unload(GPluginPlugin *plugin, gboolean shutdown, GError **error) |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1348 | { |
|
40800
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
1349 | PurpleProtocolManager *manager = purple_protocol_manager_get_default(); |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
1350 | |
|
37009
05ef6e29ea04
Rename nullprotocol back to nullprpl
Ankit Vani <a@nevitus.org>
parents:
36985
diff
changeset
|
1351 | purple_debug_info("nullprpl", "shutting down\n"); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1352 | |
|
36677
081733748bbc
Only initialize/finalize protocol class data in *_base_init/finalize for protocols.
Ankit Vani <a@nevitus.org>
parents:
36664
diff
changeset
|
1353 | /* remove the protocol from the core */ |
|
40800
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
1354 | if(!purple_protocol_manager_unregister(manager, my_protocol, error)) { |
|
36589
4a12e889d1fd
Refactored nullprotocol (renamed from nullprpl) to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1355 | return FALSE; |
|
40800
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
1356 | } |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
1357 | |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
1358 | g_clear_object(&my_protocol); |
|
17451
02adeb73ed3b
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1359 | |
|
36453
75bb4001a25f
Refactored nullprpl to build with the new plugin API. This is not final.
Ankit Vani <a@nevitus.org>
parents:
34872
diff
changeset
|
1360 | return TRUE; |
|
75bb4001a25f
Refactored nullprpl to build with the new plugin API. This is not final.
Ankit Vani <a@nevitus.org>
parents:
34872
diff
changeset
|
1361 | } |
|
36458
a9cccad073e9
Static prpls now work. Added macro PURPLE_PLUGIN_INIT(plugin-name, query-func, load-func, unload-func).
Ankit Vani <a@nevitus.org>
parents:
36457
diff
changeset
|
1362 | |
|
40945
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
1363 | GPLUGIN_NATIVE_PLUGIN_DECLARE(null); |