Mercurial > pidgin
annotate libpurple/protocols/null/nullprpl.c @ 17373:afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
directory
Closes #811
committer: Richard Laager <rlaager@wiktel.com>
author | Ryan Barrett <ryanbarrett@users.sourceforge.net> |
---|---|
date | Wed, 30 May 2007 01:21:36 +0000 |
parents | |
children | 29137f15743d |
rev | line source |
---|---|
17373
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1 /** |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
2 * purple |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
3 * |
afee8b840d91
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 |
afee8b840d91
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 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
6 * source distribution. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
7 * |
afee8b840d91
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 |
afee8b840d91
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, |
afee8b840d91
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! |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
11 * |
afee8b840d91
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 |
afee8b840d91
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, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
14 * privacy allow/block lists, chat rooms, whispering, room lists, and protocol |
afee8b840d91
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 |
afee8b840d91
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. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
17 * |
afee8b840d91
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 |
afee8b840d91
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 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
20 * demonstrate how to use the libpurple API to do pretty much everything a prpl |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
21 * might need to do. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
22 * |
afee8b840d91
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 |
afee8b840d91
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 |
afee8b840d91
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 |
afee8b840d91
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. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
27 * |
afee8b840d91
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 |
afee8b840d91
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 |
afee8b840d91
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 |
afee8b840d91
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. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
32 * |
afee8b840d91
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, |
afee8b840d91
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 |
afee8b840d91
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 |
afee8b840d91
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. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
37 * |
afee8b840d91
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 |
afee8b840d91
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 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
40 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
41 */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
42 |
afee8b840d91
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> |
afee8b840d91
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> |
afee8b840d91
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> |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
46 |
afee8b840d91
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> |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
48 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
49 #include "internal.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
50 #include "config.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
51 #include "account.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
52 #include "accountopt.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
53 #include "blist.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
54 #include "cmds.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
55 #include "conversation.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
56 #include "connection.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
57 #include "debug.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
58 #include "notify.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
59 #include "privacy.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
60 #include "prpl.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
61 #include "roomlist.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
62 #include "status.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
63 #include "util.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
64 #include "version.h" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
65 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
66 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
67 #define NULLPRPL_ID "prpl-null" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
68 static PurplePlugin *_null_protocol = NULL; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
69 |
afee8b840d91
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_ONLINE "online" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
71 #define NULL_STATUS_AWAY "away" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
72 #define NULL_STATUS_OFFLINE "offline" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
73 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
74 typedef void (*GcFunc)(PurpleConnection *from, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
75 PurpleConnection *to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
76 gpointer userdata); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
77 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
78 typedef struct { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
79 GcFunc fn; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
80 PurpleConnection *from; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
81 gpointer userdata; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
82 } GcFuncData; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
83 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
84 /* |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
85 * stores offline messages that haven't been delivered yet. maps username |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
86 * (char *) to GList * of GOfflineMessages. initialized in nullprpl_init. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
87 */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
88 GHashTable* goffline_messages = NULL; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
89 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
90 typedef struct { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
91 char *from; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
92 char *message; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
93 time_t mtime; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
94 PurpleMessageFlags flags; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
95 } GOfflineMessage; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
96 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
97 /* |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
98 * helpers |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
99 */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
100 static PurpleConnection *get_nullprpl_gc(const char *username) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
101 PurpleAccount *acct = purple_accounts_find(username, NULLPRPL_ID); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
102 if (acct && purple_account_is_connected(acct)) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
103 return acct->gc; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
104 else |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
105 return NULL; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
106 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
107 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
108 static void call_if_nullprpl(gpointer data, gpointer userdata) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
109 PurpleConnection *gc = (PurpleConnection *)(data); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
110 GcFuncData *gcfdata = (GcFuncData *)userdata; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
111 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
112 if (!strcmp(gc->account->protocol_id, NULLPRPL_ID)) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
113 gcfdata->fn(gcfdata->from, gc, gcfdata->userdata); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
114 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
115 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
116 static void foreach_nullprpl_gc(GcFunc fn, PurpleConnection *from, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
117 gpointer userdata) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
118 GcFuncData gcfdata = { .fn = fn, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
119 .from = from, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
120 .userdata = userdata }; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
121 g_list_foreach(purple_connections_get_all(), call_if_nullprpl, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
122 (gpointer)&gcfdata); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
123 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
124 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
125 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
126 typedef void(*ChatFunc)(PurpleConvChat *from, PurpleConvChat *to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
127 int id, const char *room, gpointer userdata); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
128 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
129 typedef struct { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
130 ChatFunc fn; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
131 PurpleConvChat *from_chat; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
132 gpointer userdata; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
133 } ChatFuncData; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
134 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
135 static void call_chat_func(gpointer data, gpointer userdata) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
136 PurpleConnection *to = (PurpleConnection *)data; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
137 ChatFuncData *cfdata = (ChatFuncData *)userdata; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
138 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
139 int id = cfdata->from_chat->id; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
140 PurpleConversation *conv = purple_find_chat(to, id); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
141 if (conv) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
142 PurpleConvChat *chat = purple_conversation_get_chat_data(conv); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
143 cfdata->fn(cfdata->from_chat, chat, id, conv->name, cfdata->userdata); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
144 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
145 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
146 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
147 static void foreach_gc_in_chat(ChatFunc fn, PurpleConnection *from, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
148 int id, gpointer userdata) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
149 PurpleConversation *conv = purple_find_chat(from, id); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
150 ChatFuncData cfdata = { .fn = fn, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
151 .from_chat = purple_conversation_get_chat_data(conv), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
152 .userdata = userdata }; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
153 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
154 g_list_foreach(purple_connections_get_all(), call_chat_func, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
155 (gpointer)&cfdata); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
156 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
157 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
158 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
159 static void discover_status(PurpleConnection *from, PurpleConnection *to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
160 gpointer userdata) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
161 char *from_username = from->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
162 char *to_username = to->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
163 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
164 if (purple_find_buddy(from->account, to_username)) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
165 PurpleStatus *status = purple_account_get_active_status(to->account); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
166 const char *status_id = purple_status_get_id(status); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
167 const char *message = purple_status_get_attr_string(status, "message"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
168 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
169 if (!strcmp(status_id, NULL_STATUS_ONLINE) || |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
170 !strcmp(status_id, NULL_STATUS_AWAY) || |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
171 !strcmp(status_id, NULL_STATUS_OFFLINE)) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
172 purple_debug_info("nullprpl", "%s sees that %s is %s: %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
173 from_username, to_username, status_id, message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
174 purple_prpl_got_user_status(from->account, to_username, status_id, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
175 (message) ? "message" : NULL, message, NULL); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
176 } else { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
177 purple_debug_error("nullprpl", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
178 "%s's buddy %s has an unknown status: %s, %s", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
179 from_username, to_username, status_id, message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
180 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
181 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
182 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
183 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
184 static void report_status_change(PurpleConnection *from, PurpleConnection *to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
185 gpointer userdata) { |
afee8b840d91
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", "notifying %s that %s changed status\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
187 to->account->username, from->account->username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
188 discover_status(to, from, NULL); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
189 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
190 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
191 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
192 /* |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
193 * UI callbacks |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
194 */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
195 static void nullprpl_input_user_info(PurplePluginAction *action) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
196 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
197 PurpleConnection *gc = (PurpleConnection *)action->context; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
198 PurpleAccount *acct = purple_connection_get_account(gc); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
199 purple_debug_info("nullprpl", "showing 'Set User Info' dialog for %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
200 acct->username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
201 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
202 purple_account_request_change_user_info(acct); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
203 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
204 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
205 /* this is set to the actions member of the PurplePluginInfo struct at the |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
206 * bottom. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
207 */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
208 static GList *nullprpl_actions(PurplePlugin *plugin, gpointer context) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
209 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
210 PurplePluginAction *action = purple_plugin_action_new( |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
211 _("Set User Info..."), nullprpl_input_user_info); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
212 return g_list_append(NULL, action); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
213 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
214 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
215 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
216 /* |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
217 * prpl functions |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
218 */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
219 static const char *nullprpl_list_icon(PurpleAccount *acct, PurpleBuddy *buddy) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
220 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
221 /* shamelessly steal (er, borrow) the meanwhile protocol icon. it's cute! */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
222 return "meanwhile"; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
223 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
224 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
225 static const char *nullprpl_list_emblem(PurpleBuddy *buddy) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
226 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
227 const char* emblem; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
228 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
229 if (get_nullprpl_gc(buddy->name)) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
230 PurplePresence *presence = purple_buddy_get_presence(buddy); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
231 PurpleStatus *status = purple_presence_get_active_status(presence); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
232 emblem = purple_status_get_name(status); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
233 } else { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
234 emblem = "offline"; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
235 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
236 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
237 purple_debug_info("nullprpl", "using emblem %s for %s's buddy %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
238 emblem, buddy->account->username, buddy->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
239 return emblem; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
240 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
241 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
242 static char *nullprpl_status_text(PurpleBuddy *buddy) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
243 purple_debug_info("nullprpl", "getting %s's status text for %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
244 buddy->name, buddy->account->username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
245 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
246 if (purple_find_buddy(buddy->account, buddy->name)) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
247 PurplePresence *presence = purple_buddy_get_presence(buddy); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
248 PurpleStatus *status = purple_presence_get_active_status(presence); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
249 const char *name = purple_status_get_name(status); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
250 const char *message = purple_status_get_attr_string(status, "message"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
251 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
252 char *text; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
253 if (message && strlen(message) > 0) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
254 text = g_strdup_printf("%s: %s", name, message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
255 else |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
256 text = g_strdup(name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
257 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
258 purple_debug_info("nullprpl", "%s's status text is %s\n", buddy->name, text); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
259 return text; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
260 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
261 } else { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
262 purple_debug_info("nullprpl", "...but %s is not logged in\n", buddy->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
263 return "Not logged in"; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
264 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
265 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
266 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
267 static void nullprpl_tooltip_text(PurpleBuddy *buddy, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
268 PurpleNotifyUserInfo *info, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
269 gboolean full) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
270 PurpleConnection *gc = get_nullprpl_gc(buddy->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
271 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
272 if (gc) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
273 /* they're logged in */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
274 PurplePresence *presence = purple_buddy_get_presence(buddy); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
275 PurpleStatus *status = purple_presence_get_active_status(presence); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
276 const char *msg = nullprpl_status_text(buddy); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
277 purple_notify_user_info_add_pair(info, purple_status_get_name(status), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
278 msg); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
279 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
280 if (full) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
281 const char *user_info = purple_account_get_user_info(gc->account); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
282 if (user_info) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
283 purple_notify_user_info_add_pair(info, _("User info"), user_info); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
284 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
285 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
286 } else { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
287 /* they're not logged in */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
288 purple_notify_user_info_add_pair(info, _("User info"), _("not logged in")); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
289 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
290 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
291 purple_debug_info("nullprpl", "showing %s tooltip for %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
292 (full) ? "full" : "short", buddy->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
293 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
294 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
295 static GList *nullprpl_status_types(PurpleAccount *acct) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
296 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
297 GList *types = NULL; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
298 PurpleStatusType *type; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
299 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
300 purple_debug_info("nullprpl", "returning status types for %s: %s, %s, %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
301 acct->username, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
302 NULL_STATUS_ONLINE, NULL_STATUS_AWAY, NULL_STATUS_OFFLINE); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
303 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
304 type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL_STATUS_ONLINE, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
305 NULL_STATUS_ONLINE, TRUE); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
306 purple_status_type_add_attr(type, "message", _("Online"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
307 purple_value_new(PURPLE_TYPE_STRING)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
308 types = g_list_append(types, type); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
309 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
310 type = purple_status_type_new(PURPLE_STATUS_AWAY, NULL_STATUS_AWAY, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
311 NULL_STATUS_AWAY, TRUE); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
312 purple_status_type_add_attr(type, "message", _("Away"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
313 purple_value_new(PURPLE_TYPE_STRING)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
314 types = g_list_append(types, type); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
315 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
316 type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL_STATUS_OFFLINE, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
317 NULL_STATUS_OFFLINE, TRUE); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
318 purple_status_type_add_attr(type, "message", _("Offline"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
319 purple_value_new(PURPLE_TYPE_STRING)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
320 types = g_list_append(types, type); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
321 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
322 return types; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
323 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
324 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
325 static void blist_example_menu_item(PurpleBlistNode *node, gpointer userdata) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
326 purple_debug_info("nullprpl", "example menu item clicked on user", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
327 ((PurpleBuddy *)node)->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
328 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
329 purple_notify_info(NULL, /* plugin handle or PurpleConnection */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
330 _("Primary title"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
331 _("Secondary title"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
332 _("This is the callback for the nullprpl menu item.")); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
333 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
334 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
335 static GList *nullprpl_blist_node_menu(PurpleBlistNode *node) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
336 purple_debug_info("nullprpl", "providing buddy list context menu item\n"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
337 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
338 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
339 PurpleMenuAction *action = purple_menu_action_new( |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
340 _("Nullprpl example menu item"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
341 PURPLE_CALLBACK(blist_example_menu_item), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
342 NULL, /* userdata passed to the callback */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
343 NULL); /* child menu items */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
344 return g_list_append(NULL, action); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
345 } else { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
346 return NULL; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
347 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
348 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
349 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
350 static GList *nullprpl_chat_info(PurpleConnection *gc) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
351 struct proto_chat_entry *pce; /* defined in prpl.h */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
352 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
353 purple_debug_info("nullprpl", "returning chat setting 'room'\n"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
354 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
355 pce = g_new0(struct proto_chat_entry, 1); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
356 pce->label = _(_("Chat _room")); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
357 pce->identifier = "room"; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
358 pce->required = TRUE; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
359 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
360 return g_list_append(NULL, pce); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
361 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
362 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
363 static GHashTable *nullprpl_chat_info_defaults(PurpleConnection *gc, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
364 const char *room) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
365 GHashTable *defaults; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
366 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
367 purple_debug_info("nullprpl", "returning chat default setting " |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
368 "'room' = 'default'\n"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
369 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
370 defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
371 g_hash_table_insert(defaults, "room", g_strdup("default")); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
372 return defaults; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
373 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
374 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
375 static void nullprpl_login(PurpleAccount *acct) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
376 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
377 PurpleConnection *gc = purple_account_get_connection(acct); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
378 GList *offline_messages; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
379 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
380 purple_debug_info("nullprpl", "logging in %s\n", acct->username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
381 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
382 purple_connection_update_progress(gc, _("Connecting"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
383 0, /* which connection step this is */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
384 2); /* total number of steps */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
385 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
386 purple_connection_update_progress(gc, _("Connected"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
387 1, /* which connection step this is */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
388 2); /* total number of steps */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
389 purple_connection_set_state(gc, PURPLE_CONNECTED); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
390 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
391 /* tell purple about everyone on our buddy list who's connected */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
392 foreach_nullprpl_gc(discover_status, gc, NULL); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
393 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
394 /* notify other nullprpl accounts */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
395 foreach_nullprpl_gc(report_status_change, gc, NULL); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
396 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
397 /* fetch stored offline messages */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
398 purple_debug_info("nullprpl", "checking for offline messages for %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
399 acct->username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
400 offline_messages = g_hash_table_lookup(goffline_messages, acct->username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
401 while (offline_messages) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
402 GOfflineMessage *message = (GOfflineMessage *)offline_messages->data; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
403 purple_debug_info("nullprpl", "delivering offline message to %s: %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
404 acct->username, message->message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
405 serv_got_im(gc, message->from, message->message, message->flags, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
406 message->mtime); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
407 offline_messages = g_list_next(offline_messages); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
408 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
409 g_free(message->from); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
410 g_free(message->message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
411 g_free(message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
412 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
413 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
414 g_list_free(offline_messages); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
415 g_hash_table_remove(goffline_messages, &acct->username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
416 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
417 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
418 static void nullprpl_close(PurpleConnection *gc) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
419 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
420 /* notify other nullprpl accounts */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
421 foreach_nullprpl_gc(report_status_change, gc, NULL); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
422 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
423 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
424 static int nullprpl_send_im(PurpleConnection *gc, const char *who, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
425 const char *message, PurpleMessageFlags flags) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
426 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
427 const char *from_username = gc->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
428 PurpleMessageFlags receive_flags = ((flags & ~PURPLE_MESSAGE_SEND) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
429 | PURPLE_MESSAGE_RECV); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
430 PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
431 PurpleConnection *to; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
432 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
433 purple_debug_info("nullprpl", "sending message from %s to %s: %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
434 from_username, who, message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
435 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
436 /* is the sender blocked by the recipient's privacy settings? */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
437 if (!purple_privacy_check(to_acct, gc->account->username)) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
438 char *msg = g_strdup_printf( |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
439 _("Your message was blocked by %s's privacy settings."), who); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
440 purple_debug_info("nullprpl", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
441 "discarding; %s is blocked by %s's privacy settings\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
442 from_username, who); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
443 purple_conv_present_error(who, gc->account, msg); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
444 g_free(msg); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
445 return 0; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
446 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
447 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
448 /* is the recipient online? */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
449 to = get_nullprpl_gc(who); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
450 if (to) { /* yes, send */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
451 serv_got_im(to, from_username, message, receive_flags, time(NULL)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
452 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
453 } else { /* nope, store as an offline message */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
454 GOfflineMessage *offline_message; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
455 GList *messages; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
456 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
457 purple_debug_info("nullprpl", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
458 "%s is offline, sending as offline message\n", who); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
459 offline_message = g_new0(GOfflineMessage, 1); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
460 offline_message->from = g_strdup(from_username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
461 offline_message->message = g_strdup(message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
462 offline_message->mtime = time(NULL); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
463 offline_message->flags = receive_flags; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
464 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
465 messages = g_hash_table_lookup(goffline_messages, who); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
466 messages = g_list_append(messages, offline_message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
467 g_hash_table_insert(goffline_messages, g_strdup(who), messages); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
468 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
469 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
470 return 1; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
471 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
472 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
473 static void nullprpl_set_info(PurpleConnection *gc, const char *info) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
474 purple_debug_info("nullprpl", "setting %s's user info to %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
475 gc->account->username, info); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
476 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
477 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
478 static char *typing_state_to_string(PurpleTypingState typing) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
479 switch (typing) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
480 case PURPLE_NOT_TYPING: return "is not typing"; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
481 case PURPLE_TYPING: return "is typing"; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
482 case PURPLE_TYPED: return "stopped typing momentarily"; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
483 default: return "unknown typing state"; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
484 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
485 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
486 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
487 static void notify_typing(PurpleConnection *from, PurpleConnection *to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
488 gpointer typing) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
489 char *from_username = from->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
490 char *action = typing_state_to_string((PurpleTypingState)typing); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
491 purple_debug_info("nullprpl", "notifying %s that %s %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
492 to->account->username, from_username, action); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
493 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
494 serv_got_typing(to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
495 from_username, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
496 0, /* if non-zero, a timeout in seconds after which to |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
497 * reset the typing status to PURPLE_NOT_TYPING */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
498 (PurpleTypingState)typing); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
499 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
500 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
501 static unsigned int nullprpl_send_typing(PurpleConnection *gc, const char *name, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
502 PurpleTypingState typing) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
503 purple_debug_info("nullprpl", "%s %s\n", gc->account->username, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
504 typing_state_to_string(typing)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
505 foreach_nullprpl_gc(notify_typing, gc, (gpointer)typing); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
506 return 0; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
507 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
508 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
509 static void nullprpl_get_info(PurpleConnection *gc, const char *username) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
510 const char *body; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
511 PurpleNotifyUserInfo *info = purple_notify_user_info_new(); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
512 PurpleAccount *acct; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
513 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
514 purple_debug_info("nullprpl", "Fetching %s's user info for %s\n", username, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
515 gc->account->username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
516 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
517 if (!get_nullprpl_gc(username)) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
518 char *msg = g_strdup_printf(_("%s is not logged in."), username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
519 purple_notify_error(gc, _("User Info"), _("User info not available. "), msg); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
520 g_free(msg); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
521 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
522 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
523 acct = purple_accounts_find(username, NULLPRPL_ID); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
524 if (acct) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
525 body = purple_account_get_user_info(acct); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
526 else |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
527 body = _("No user info."); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
528 purple_notify_user_info_add_pair(info, "Info", body); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
529 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
530 /* show a buddy's user info in a nice dialog box */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
531 purple_notify_userinfo(gc, /* connection the buddy info came through */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
532 username, /* buddy's username */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
533 info, /* body */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
534 NULL, /* callback called when dialog closed */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
535 NULL); /* userdata for callback */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
536 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
537 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
538 static void nullprpl_set_status(PurpleAccount *acct, PurpleStatus *status) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
539 const char *msg = purple_status_get_attr_string(status, "message"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
540 purple_debug_info("nullprpl", "setting %s's status to %s: %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
541 acct->username, purple_status_get_name(status), msg); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
542 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
543 foreach_nullprpl_gc(report_status_change, get_nullprpl_gc(acct->username), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
544 NULL); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
545 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
546 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
547 static void nullprpl_set_idle(PurpleConnection *gc, int idletime) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
548 purple_debug_info("nullprpl", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
549 "purple reports that %s has been idle for %d seconds\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
550 gc->account->username, idletime); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
551 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
552 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
553 static void nullprpl_change_passwd(PurpleConnection *gc, const char *old_pass, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
554 const char *new_pass) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
555 purple_debug_info("nullprpl", "%s wants to change their password\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
556 gc->account->username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
557 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
558 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
559 static void nullprpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
560 PurpleGroup *group) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
561 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
562 char *username = gc->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
563 PurpleConnection *buddy_gc = get_nullprpl_gc(buddy->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
564 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
565 purple_debug_info("nullprpl", "adding %s to %s's buddy list\n", buddy->name, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
566 username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
567 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
568 if (buddy_gc) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
569 PurpleAccount *buddy_acct = buddy_gc->account; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
570 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
571 discover_status(gc, buddy_gc, NULL); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
572 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
573 if (purple_find_buddy(buddy_acct, username)) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
574 purple_debug_info("nullprpl", "%s is already on %s's buddy list\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
575 username, buddy->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
576 } else { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
577 purple_debug_info("nullprpl", "asking %s if they want to add %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
578 buddy->name, username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
579 purple_account_request_add(buddy_acct, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
580 username, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
581 NULL, /* local account id (rarely used) */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
582 NULL, /* alias */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
583 NULL); /* message */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
584 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
585 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
586 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
587 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
588 static void nullprpl_add_buddies(PurpleConnection *gc, GList *buddies, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
589 GList *groups) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
590 GList *buddy = buddies; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
591 GList *group = groups; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
592 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
593 purple_debug_info("nullprpl", "adding multiple buddies\n"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
594 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
595 while (buddy && group) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
596 nullprpl_add_buddy(gc, (PurpleBuddy *)buddy->data, (PurpleGroup *)group->data); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
597 buddy = g_list_next(buddy); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
598 group = g_list_next(group); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
599 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
600 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
601 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
602 static void nullprpl_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
603 PurpleGroup *group) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
604 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
605 purple_debug_info("nullprpl", "removing %s from %s's buddy list\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
606 buddy->name, gc->account->username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
607 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
608 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
609 static void nullprpl_remove_buddies(PurpleConnection *gc, GList *buddies, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
610 GList *groups) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
611 GList *buddy = buddies; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
612 GList *group = groups; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
613 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
614 purple_debug_info("nullprpl", "removing multiple buddies\n"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
615 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
616 while (buddy && group) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
617 nullprpl_remove_buddy(gc, (PurpleBuddy *)buddy->data, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
618 (PurpleGroup *)group->data); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
619 buddy = g_list_next(buddy); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
620 group = g_list_next(group); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
621 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
622 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
623 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
624 /* |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
625 * nullprpl uses purple's local whitelist and blacklist, stored in blist.xml, as |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
626 * its authoritative privacy settings, and uses purple's logic (specifically |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
627 * purple_privacy_check(), from privacy.h), to determine whether messages are |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
628 * allowed or blocked. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
629 */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
630 static void nullprpl_add_permit(PurpleConnection *gc, const char *name) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
631 purple_debug_info("nullprpl", "%s adds %s to their allowed list\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
632 gc->account->username, name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
633 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
634 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
635 static void nullprpl_add_deny(PurpleConnection *gc, const char *name) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
636 purple_debug_info("nullprpl", "%s adds %s to their blocked list\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
637 gc->account->username, name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
638 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
639 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
640 static void nullprpl_rem_permit(PurpleConnection *gc, const char *name) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
641 purple_debug_info("nullprpl", "%s removes %s from their allowed list\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
642 gc->account->username, name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
643 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
644 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
645 static void nullprpl_rem_deny(PurpleConnection *gc, const char *name) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
646 purple_debug_info("nullprpl", "%s removes %s from their blocked list\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
647 gc->account->username, name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
648 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
649 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
650 static void nullprpl_set_permit_deny(PurpleConnection *gc) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
651 /* this is for synchronizing the local black/whitelist with the server. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
652 * for nullprpl, it's a noop. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
653 */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
654 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
655 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
656 static void joined_chat(PurpleConvChat *from, PurpleConvChat *to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
657 int id, const char *room, gpointer userdata) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
658 /* tell their chat window that we joined */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
659 purple_debug_info("nullprpl", "%s sees that %s joined chat room %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
660 to->nick, from->nick, room); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
661 purple_conv_chat_add_user(to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
662 from->nick, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
663 NULL, /* user-provided join message, IRC style */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
664 PURPLE_CBFLAGS_NONE, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
665 TRUE); /* show a join message */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
666 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
667 if (from != to) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
668 /* add them to our chat window */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
669 purple_debug_info("nullprpl", "%s sees that %s is in chat room %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
670 from->nick, to->nick, room); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
671 purple_conv_chat_add_user(from, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
672 to->nick, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
673 NULL, /* user-provided join message, IRC style */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
674 PURPLE_CBFLAGS_NONE, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
675 FALSE); /* show a join message */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
676 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
677 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
678 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
679 static void nullprpl_join_chat(PurpleConnection *gc, GHashTable *components) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
680 char *username = gc->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
681 char *room = g_hash_table_lookup(components, "room"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
682 int chat_id = g_str_hash(room); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
683 purple_debug_info("nullprpl", "%s is joining chat room %s\n", username, room); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
684 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
685 if (!purple_find_chat(gc, chat_id)) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
686 serv_got_joined_chat(gc, chat_id, room); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
687 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
688 /* tell everyone that we joined, and add them if they're already there */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
689 foreach_gc_in_chat(joined_chat, gc, chat_id, NULL); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
690 } else { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
691 purple_debug_info("nullprpl", "%s is already in chat room %s\n", username, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
692 room); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
693 purple_notify_info(gc, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
694 _("Join chat"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
695 _("Join chat"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
696 g_strdup_printf("%s is already in chat room %s.", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
697 username, room)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
698 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
699 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
700 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
701 static void nullprpl_reject_chat(PurpleConnection *gc, GHashTable *components) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
702 char *invited_by = g_hash_table_lookup(components, "invited_by"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
703 char *room = g_hash_table_lookup(components, "room"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
704 char *username = gc->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
705 PurpleConnection *invited_by_gc = get_nullprpl_gc(invited_by); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
706 char *message = g_strdup_printf( |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
707 "%s %s %s.", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
708 username, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
709 _("has rejected your invitation to join the chat room"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
710 room); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
711 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
712 purple_debug_info("nullprpl", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
713 "%s has rejected %s's invitation to join chat room %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
714 username, invited_by, room); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
715 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
716 purple_notify_info(invited_by_gc, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
717 _("Chat invitation rejected"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
718 _("Chat invitation rejected"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
719 message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
720 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
721 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
722 static char *nullprpl_get_chat_name(GHashTable *components) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
723 char *room = g_hash_table_lookup(components, "room"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
724 purple_debug_info("nullprpl", "reporting chat room name '%s'\n", room); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
725 return room; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
726 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
727 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
728 static void nullprpl_chat_invite(PurpleConnection *gc, int id, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
729 const char *message, const char *who) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
730 char *username = gc->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
731 PurpleConversation *conv = purple_find_chat(gc, id); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
732 char *room = conv->name; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
733 PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
734 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
735 purple_debug_info("nullprpl", "%s is inviting %s to join chat room %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
736 username, who, room); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
737 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
738 if (to_acct) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
739 PurpleConversation *to_conv = purple_find_chat(to_acct->gc, id); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
740 if (to_conv) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
741 purple_debug_info("nullprpl", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
742 "%s is already in chat room %s; " |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
743 "ignoring invitation from %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
744 who, room, username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
745 purple_notify_info(gc, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
746 _("Chat invitation"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
747 _("Chat invitation"), |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
748 g_strdup_printf("%s is already in chat room %s.", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
749 who, room)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
750 } else { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
751 GHashTable *components; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
752 components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, free); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
753 g_hash_table_replace(components, "room", g_strdup(room)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
754 g_hash_table_replace(components, "invited_by", g_strdup(username)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
755 serv_got_chat_invite(to_acct->gc, room, username, message, components); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
756 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
757 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
758 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
759 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
760 static void left_chat_room(PurpleConvChat *from, PurpleConvChat *to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
761 int id, const char *room, gpointer userdata) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
762 if (from != to) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
763 /* tell their chat window that we left */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
764 purple_debug_info("nullprpl", "%s sees that %s left chat room %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
765 to->nick, from->nick, room); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
766 purple_conv_chat_remove_user(to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
767 from->nick, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
768 NULL); /* user-provided message, IRC style */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
769 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
770 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
771 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
772 static void nullprpl_chat_leave(PurpleConnection *gc, int id) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
773 PurpleConversation *conv = purple_find_chat(gc, id); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
774 purple_debug_info("nullprpl", "%s is leaving chat room %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
775 gc->account->username, conv->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
776 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
777 /* tell everyone that we left */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
778 foreach_gc_in_chat(left_chat_room, gc, id, NULL); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
779 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
780 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
781 static PurpleCmdRet send_whisper(PurpleConversation *conv, const gchar *cmd, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
782 gchar **args, gchar **error, void *userdata) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
783 const char *to_username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
784 const char *message; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
785 const char *from_username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
786 PurpleConvChat *chat; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
787 PurpleConvChatBuddy *chat_buddy; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
788 PurpleConnection *to; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
789 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
790 /* parse args */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
791 to_username = args[0]; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
792 message = args[1]; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
793 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
794 if (!to_username || strlen(to_username) == 0) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
795 *error = g_strdup(_("Whisper is missing recipient.")); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
796 return PURPLE_CMD_RET_FAILED; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
797 } else if (!message || strlen(message) == 0) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
798 *error = g_strdup(_("Whisper is missing message.")); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
799 return PURPLE_CMD_RET_FAILED; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
800 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
801 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
802 from_username = conv->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
803 purple_debug_info("nullprpl", "%s whispers to %s in chat room %s: %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
804 from_username, to_username, conv->name, message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
805 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
806 chat = purple_conversation_get_chat_data(conv); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
807 chat_buddy = purple_conv_chat_cb_find(chat, to_username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
808 to = get_nullprpl_gc(to_username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
809 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
810 if (!chat_buddy) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
811 /* this will be freed by the caller */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
812 *error = g_strdup_printf(_("%s is not logged in."), to_username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
813 return PURPLE_CMD_RET_FAILED; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
814 } else if (!to) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
815 *error = g_strdup_printf(_("%s is not in this chat room."), to_username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
816 return PURPLE_CMD_RET_FAILED; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
817 } else { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
818 /* write the whisper in the sender's chat window */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
819 char *message_to = g_strdup_printf("%s (to %s)", message, to_username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
820 purple_conv_chat_write(chat, from_username, message_to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
821 PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_WHISPER, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
822 time(NULL)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
823 g_free(message_to); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
824 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
825 /* send the whisper */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
826 serv_chat_whisper(to, chat->id, from_username, message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
827 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
828 return PURPLE_CMD_RET_OK; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
829 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
830 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
831 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
832 static void nullprpl_chat_whisper(PurpleConnection *gc, int id, const char *who, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
833 const char *message) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
834 char *username = gc->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
835 PurpleConversation *conv = purple_find_chat(gc, id); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
836 purple_debug_info("nullprpl", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
837 "%s receives whisper from %s in chat room %s: %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
838 username, who, conv->name, message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
839 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
840 /* receive whisper on recipient's account */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
841 serv_got_chat_in(gc, id, who, PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_WHISPER, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
842 message, time(NULL)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
843 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
844 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
845 static void receive_chat_message(PurpleConvChat *from, PurpleConvChat *to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
846 int id, const char *room, gpointer userdata) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
847 const char *message = (const char *)userdata; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
848 PurpleConnection *to_gc = get_nullprpl_gc(to->nick); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
849 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
850 purple_debug_info("nullprpl", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
851 "%s receives message from %s in chat room %s: %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
852 to->nick, from->nick, room, message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
853 serv_got_chat_in(to_gc, id, from->nick, PURPLE_MESSAGE_RECV, message, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
854 time(NULL)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
855 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
856 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
857 static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
858 PurpleMessageFlags flags) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
859 char *username = gc->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
860 PurpleConversation *conv = purple_find_chat(gc, id); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
861 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
862 if (conv) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
863 purple_debug_info("nullprpl", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
864 "%s is sending message to chat room %s: %s\n", username, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
865 conv->name, message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
866 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
867 /* send message to everyone in the chat room */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
868 foreach_gc_in_chat(receive_chat_message, gc, id, (gpointer)message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
869 return 0; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
870 } else { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
871 purple_debug_info("nullprpl", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
872 "tried to send message from %s to chat room #%d: %s\n" |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
873 "but couldn't find chat room", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
874 username, id, message); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
875 return -1; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
876 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
877 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
878 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
879 static void nullprpl_register_user(PurpleAccount *acct) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
880 purple_debug_info("nullprpl", "registering account for %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
881 acct->username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
882 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
883 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
884 static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
885 PurpleConversation *conv = purple_find_chat(gc, id); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
886 purple_debug_info("nullprpl", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
887 "retrieving %s's info for %s in chat room %s\n", who, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
888 gc->account->username, conv->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
889 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
890 nullprpl_get_info(gc, who); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
891 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
892 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
893 static void nullprpl_alias_buddy(PurpleConnection *gc, const char *who, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
894 const char *alias) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
895 purple_debug_info("nullprpl", "%s sets %'s alias to %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
896 gc->account->username, who, alias); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
897 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
898 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
899 static void nullprpl_group_buddy(PurpleConnection *gc, const char *who, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
900 const char *old_group, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
901 const char *new_group) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
902 purple_debug_info("nullprpl", "%s has moved %s from group %s to group %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
903 who, old_group, new_group); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
904 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
905 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
906 static void nullprpl_rename_group(PurpleConnection *gc, const char *old_name, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
907 PurpleGroup *group, GList *moved_buddies) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
908 purple_debug_info("nullprpl", "%s has renamed group %s to %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
909 gc->account->username, old_name, group->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
910 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
911 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
912 static void nullprpl_convo_closed(PurpleConnection *gc, const char *who) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
913 purple_debug_info("nullprpl", "%s's conversation with %s was closed\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
914 gc->account->username, who); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
915 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
916 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
917 /* normalize a username (e.g. remove whitespace, add default domain, etc.) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
918 * for nullprpl, this is a noop. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
919 */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
920 static const char *nullprpl_normalize(const PurpleAccount *acct, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
921 const char *input) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
922 return NULL; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
923 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
924 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
925 static void nullprpl_set_buddy_icon(PurpleConnection *gc, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
926 PurpleStoredImage *img) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
927 purple_debug_info("nullprpl", "setting %s's buddy icon to %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
928 gc->account->username, purple_imgstore_get_filename(img)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
929 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
930 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
931 static void nullprpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
932 purple_debug_info("nullprpl", "%s has removed group %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
933 gc->account->username, group->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
934 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
935 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
936 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
937 static void set_chat_topic_fn(PurpleConvChat *from, PurpleConvChat *to, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
938 int id, const char *room, gpointer userdata) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
939 const char *topic = (const char *)userdata; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
940 const char *username = from->conv->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
941 char *msg; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
942 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
943 purple_conv_chat_set_topic(to, username, topic); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
944 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
945 if (topic && strlen(topic) > 0) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
946 msg = g_strdup_printf(_("%s sets topic to: %s"), username, topic); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
947 else |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
948 msg = g_strdup_printf(_("%s clears topic"), username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
949 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
950 purple_conv_chat_write(to, username, msg, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
951 PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
952 time(NULL)); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
953 g_free(msg); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
954 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
955 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
956 static void nullprpl_set_chat_topic(PurpleConnection *gc, int id, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
957 const char *topic) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
958 PurpleConversation *conv = purple_find_chat(gc, id); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
959 PurpleConvChat *chat = purple_conversation_get_chat_data(conv); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
960 const char *last_topic; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
961 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
962 if (!chat) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
963 return; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
964 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
965 purple_debug_info("nullprpl", "%s sets topic of chat room '%s' to '%s'\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
966 gc->account->username, conv->name, topic); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
967 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
968 last_topic = purple_conv_chat_get_topic(chat); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
969 if ((!topic && !last_topic) || |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
970 (topic && last_topic && !strcmp(topic, last_topic))) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
971 return; /* topic is unchanged, this is a noop */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
972 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
973 foreach_gc_in_chat(set_chat_topic_fn, gc, id, (gpointer)topic); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
974 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
975 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
976 static gboolean nullprpl_finish_get_roomlist(gpointer roomlist) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
977 purple_roomlist_set_in_progress((PurpleRoomlist *)roomlist, FALSE); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
978 return FALSE; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
979 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
980 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
981 static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
982 char *username = gc->account->username; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
983 PurpleRoomlist *roomlist = purple_roomlist_new(gc->account); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
984 GList *fields = NULL; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
985 PurpleRoomlistField *field; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
986 GList *chats; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
987 GList *seen_ids = NULL; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
988 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
989 purple_debug_info("nullprpl", "%s asks for room list; returning:\n", username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
990 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
991 /* set up the room list */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
992 field = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "room", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
993 "room", TRUE /* hidden */); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
994 fields = g_list_append(fields, field); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
995 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
996 field = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, "Id", "Id", FALSE); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
997 fields = g_list_append(fields, field); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
998 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
999 purple_roomlist_set_fields(roomlist, fields); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1000 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1001 /* add each chat room. the chat ids are cached in seen_ids so that each room |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1002 * is only returned once, even if multiple users are in it. */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1003 for (chats = purple_get_chats(); chats; chats = g_list_next(chats)) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1004 PurpleConversation *conv = (PurpleConversation *)chats->data; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1005 PurpleRoomlistRoom *room; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1006 char *name = conv->name; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1007 int id = purple_conversation_get_chat_data(conv)->id; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1008 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1009 /* have we already added this room? */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1010 if (g_list_find_custom(seen_ids, name, (GCompareFunc)strcmp)) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1011 continue; /* yes! try the next one. */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1012 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1013 seen_ids = g_list_append(seen_ids, name); /* no, it's new. */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1014 purple_debug_info("nullprpl", "%s (%d), ", name, id); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1015 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1016 room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, NULL); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1017 purple_roomlist_room_add_field(roomlist, room, name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1018 purple_roomlist_room_add_field(roomlist, room, &id); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1019 purple_roomlist_room_add(roomlist, room); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1020 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1021 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1022 purple_timeout_add(1 /* ms */, nullprpl_finish_get_roomlist, roomlist); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1023 return roomlist; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1024 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1025 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1026 static void nullprpl_roomlist_cancel(PurpleRoomlist *list) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1027 purple_debug_info("nullprpl", "%s asked to cancel room list request\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1028 list->account->username); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1029 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1030 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1031 static void nullprpl_roomlist_expand_category(PurpleRoomlist *list, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1032 PurpleRoomlistRoom *category) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1033 purple_debug_info("nullprpl", "%s asked to expand room list category %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1034 list->account->username, category->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1035 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1036 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1037 /* nullprpl doesn't support file transfer...yet... */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1038 static gboolean nullprpl_can_receive_file(PurpleConnection *gc, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1039 const char *who) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1040 return FALSE; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1041 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1042 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1043 static gboolean nullprpl_offline_message(const PurpleBuddy *buddy) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1044 purple_debug_info("nullprpl", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1045 "reporting that offline messages are supported for %s\n", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1046 buddy->name); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1047 return TRUE; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1048 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1049 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1050 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1051 /* |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1052 * prpl stuff. see prpl.h for more information. |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1053 */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1054 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1055 static PurplePluginProtocolInfo prpl_info = |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1056 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1057 OPT_PROTO_NO_PASSWORD | OPT_PROTO_CHAT_TOPIC, /* options */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1058 NULL, /* user_splits, initialized in nullprpl_init() */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1059 NULL, /* protocol_options, initialized in nullprpl_init() */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1060 { /* icon_spec, a PurpleBuddyIconSpec */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1061 "png,jpg,gif", /* format */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1062 0, /* min_width */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1063 0, /* min_height */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1064 128, /* max_width */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1065 128, /* max_height */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1066 10000, /* max_filesize */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1067 PURPLE_ICON_SCALE_DISPLAY, /* scale_rules */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1068 }, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1069 nullprpl_list_icon, /* list_icon */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1070 nullprpl_list_emblem, /* list_emblem */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1071 nullprpl_status_text, /* status_text */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1072 nullprpl_tooltip_text, /* tooltip_text */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1073 nullprpl_status_types, /* status_types */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1074 nullprpl_blist_node_menu, /* blist_node_menu */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1075 nullprpl_chat_info, /* chat_info */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1076 nullprpl_chat_info_defaults, /* chat_info_defaults */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1077 nullprpl_login, /* login */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1078 nullprpl_close, /* close */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1079 nullprpl_send_im, /* send_im */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1080 nullprpl_set_info, /* set_info */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1081 nullprpl_send_typing, /* send_typing */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1082 nullprpl_get_info, /* get_info */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1083 nullprpl_set_status, /* set_status */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1084 nullprpl_set_idle, /* set_idle */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1085 nullprpl_change_passwd, /* change_passwd */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1086 nullprpl_add_buddy, /* add_buddy */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1087 nullprpl_add_buddies, /* add_buddies */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1088 nullprpl_remove_buddy, /* remove_buddy */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1089 nullprpl_remove_buddies, /* remove_buddies */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1090 nullprpl_add_permit, /* add_permit */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1091 nullprpl_add_deny, /* add_deny */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1092 nullprpl_rem_permit, /* rem_permit */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1093 nullprpl_rem_deny, /* rem_deny */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1094 nullprpl_set_permit_deny, /* set_permit_deny */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1095 nullprpl_join_chat, /* join_chat */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1096 nullprpl_reject_chat, /* reject_chat */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1097 nullprpl_get_chat_name, /* get_chat_name */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1098 nullprpl_chat_invite, /* chat_invite */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1099 nullprpl_chat_leave, /* chat_leave */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1100 nullprpl_chat_whisper, /* chat_whisper */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1101 nullprpl_chat_send, /* chat_send */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1102 NULL, /* keepalive */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1103 nullprpl_register_user, /* register_user */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1104 nullprpl_get_cb_info, /* get_cb_info */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1105 NULL, /* get_cb_away */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1106 nullprpl_alias_buddy, /* alias_buddy */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1107 nullprpl_group_buddy, /* group_buddy */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1108 nullprpl_rename_group, /* rename_group */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1109 NULL, /* buddy_free */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1110 nullprpl_convo_closed, /* convo_closed */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1111 nullprpl_normalize, /* normalize */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1112 nullprpl_set_buddy_icon, /* set_buddy_icon */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1113 nullprpl_remove_group, /* remove_group */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1114 NULL, /* get_cb_real_name */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1115 nullprpl_set_chat_topic, /* set_chat_topic */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1116 NULL, /* find_blist_chat */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1117 nullprpl_roomlist_get_list, /* roomlist_get_list */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1118 nullprpl_roomlist_cancel, /* roomlist_cancel */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1119 nullprpl_roomlist_expand_category, /* roomlist_expand_category */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1120 nullprpl_can_receive_file, /* can_receive_file */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1121 NULL, /* send_file */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1122 NULL, /* new_xfer */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1123 nullprpl_offline_message, /* offline_message */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1124 NULL, /* whiteboard_prpl_ops */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1125 NULL, /* send_raw */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1126 NULL, /* roomlist_room_serialize */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1127 NULL, /* padding... */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1128 NULL, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1129 NULL, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1130 NULL, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1131 }; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1132 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1133 static void nullprpl_init(PurplePlugin *plugin) |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1134 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1135 /* see accountopt.h for information about user splits and protocol options */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1136 PurpleAccountUserSplit *split = purple_account_user_split_new( |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1137 _("Example user split (unused)"), /* text shown to user */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1138 "default", /* default value */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1139 '@'); /* field separator */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1140 PurpleAccountOption *option = purple_account_option_string_new( |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1141 _("Example option (unused)"), /* text shown to user */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1142 "example", /* pref name */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1143 "default"); /* default value */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1144 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1145 purple_debug_info("nullprpl", "starting up\n"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1146 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1147 prpl_info.user_splits = g_list_append(NULL, split); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1148 prpl_info.protocol_options = g_list_append(NULL, option); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1149 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1150 /* register whisper chat command, /msg */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1151 purple_cmd_register("msg", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1152 "ws", /* args: recipient and message */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1153 PURPLE_CMD_P_DEFAULT, /* priority */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1154 PURPLE_CMD_FLAG_CHAT, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1155 "prpl-null", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1156 send_whisper, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1157 "msg <username> <message>: send a private message, aka a whisper", |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1158 NULL); /* userdata */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1159 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1160 /* get ready to store offline messages */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1161 goffline_messages = g_hash_table_new_full(g_str_hash, /* hash fn */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1162 g_str_equal, /* key comparison fn */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1163 g_free, /* key free fn */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1164 NULL); /* value free fn */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1165 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1166 _null_protocol = plugin; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1167 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1168 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1169 static void nullprpl_destroy(PurplePlugin *plugin) { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1170 purple_debug_info("nullprpl", "shutting down\n"); |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1171 } |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1172 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1173 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1174 static PurplePluginInfo info = |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1175 { |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1176 PURPLE_PLUGIN_MAGIC, /* magic */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1177 PURPLE_MAJOR_VERSION, /* major_version */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1178 PURPLE_MINOR_VERSION, /* minor_version */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1179 PURPLE_PLUGIN_PROTOCOL, /* type */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1180 NULL, /* ui_requirement */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1181 0, /* flags */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1182 NULL, /* dependencies */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1183 PURPLE_PRIORITY_DEFAULT, /* priority */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1184 NULLPRPL_ID, /* id */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1185 "Nullprpl", /* name */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1186 "0.3", /* version */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1187 "Null Protocol Plugin", /* summary */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1188 "Null Protocol Plugin", /* description */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1189 "Ryan Barrett <nullprpl@ryanb.org>", /* author */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1190 "http://snarfed.org/space/pidgin+null+protocol+plugin", /* homepage */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1191 NULL, /* load */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1192 NULL, /* unload */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1193 nullprpl_destroy, /* destroy */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1194 NULL, /* ui_info */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1195 &prpl_info, /* extra_info */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1196 NULL, /* prefs_info */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1197 nullprpl_actions, /* actions */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1198 NULL, /* padding... */ |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1199 NULL, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1200 NULL, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1201 NULL, |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1202 }; |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1203 |
afee8b840d91
this patch adds nullprpl, a mock protocol plugin, to the libpurple/protocols
Ryan Barrett <ryanbarrett@users.sourceforge.net>
parents:
diff
changeset
|
1204 PURPLE_INIT_PLUGIN(null, nullprpl_init, info); |