libpurple/protocols/facebook/util.h

Mon, 12 Sep 2016 08:55:35 -0500

author
Mike Ruprecht <cmaiku@gmail.com>
date
Mon, 12 Sep 2016 08:55:35 -0500
changeset 38142
1dff6e343f9f
parent 37471
32c1e77d0474
child 39819
3554dac2991b
permissions
-rw-r--r--

gg: Protect against issues when closing while connecting

Since the GIOStream is cancelled when data is freed, any cancelled
callbacks are called after such data is freed. This patch guards against
cancelled calls by safely returning without accessing any freed data if
the connection has been cancelled (aka closed).

Futhermore, if GG tries to connect and is quickly disconnected,
ggp_tcpsocket_close() is never called. As far as I can tell, it's an
existing bug, but PurpleSockets both work differently when closing and
are closed by the connection if any leak. So the issue wasn't a major
problem. This patch lessens the issue by guarding against it, but it
should be fixed at some point.

37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
1 /* purple
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
2 *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
3 * Purple is the legal property of its developers, whose names are too numerous
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
5 * source distribution.
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
6 *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
10 * (at your option) any later version.
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
11 *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
15 * GNU General Public License for more details.
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
16 *
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
20 */
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
21
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
22 #ifndef _FACEBOOK_UTIL_H_
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
23 #define _FACEBOOK_UTIL_H_
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
24
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
25 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
26 * SECTION:util
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
27 * @section_id: facebook-util
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
28 * @short_description: <filename>util.h</filename>
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
29 * @title: General Utilities
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
30 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
31 * The general utilities.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
32 */
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
33
37309
556eea7a45da facebook: merged local glibcompat.h into libpurple's
James Geboski <jgeboski@gmail.com>
parents: 37289
diff changeset
34 #include <glib.h>
556eea7a45da facebook: merged local glibcompat.h into libpurple's
James Geboski <jgeboski@gmail.com>
parents: 37289
diff changeset
35
37310
a1a5f0ac39f2 facebook: cleaned up libpurple includes
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
36 #include <libpurple/util.h>
a1a5f0ac39f2 facebook: cleaned up libpurple includes
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
37
a1a5f0ac39f2 facebook: cleaned up libpurple includes
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
38 #include "account.h"
a1a5f0ac39f2 facebook: cleaned up libpurple includes
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
39 #include "conversationtypes.h"
a1a5f0ac39f2 facebook: cleaned up libpurple includes
James Geboski <jgeboski@gmail.com>
parents: 37309
diff changeset
40 #include "debug.h"
37258
291b6e1acc24 facebook: implemented group chat support
James Geboski <jgeboski@gmail.com>
parents: 37250
diff changeset
41 #include "connection.h"
37317
143a4d8db15c facebook: implemented self messages
James Geboski <jgeboski@gmail.com>
parents: 37310
diff changeset
42 #include "conversation.h"
37258
291b6e1acc24 facebook: implemented group chat support
James Geboski <jgeboski@gmail.com>
parents: 37250
diff changeset
43
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
44 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
45 * FB_UTIL_DEBUG_INFO:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
46 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
47 * Shortcut #PurpleDebugLevel for unsafe and verbose info messages.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
48 */
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
49 #define FB_UTIL_DEBUG_INFO ( \
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
50 PURPLE_DEBUG_INFO | \
37278
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
51 FB_UTIL_DEBUG_FLAG_UNSAFE | \
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
52 FB_UTIL_DEBUG_FLAG_VERBOSE \
37278
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
53 )
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
54
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
55 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
56 * FB_UTIL_ERROR:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
57 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
58 * The #GQuark of the domain of utility errors.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
59 */
37471
32c1e77d0474 facebook: coding style consistencies
James Geboski <jgeboski@gmail.com>
parents: 37416
diff changeset
60 #define FB_UTIL_ERROR fb_util_error_quark()
37284
53cb588d8760 facebook: implemented kicking/leaving group chats
James Geboski <jgeboski@gmail.com>
parents: 37278
diff changeset
61
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
62 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
63 * FbUtilRequestBuddyFunc:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
64 * @buddies: The list of #PurpleBuddy's.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
65 * @data: The user-defined data.
37358
fbb9041f0c01 facebook: added missing GTK-Doc description
James Geboski <jgeboski@gmail.com>
parents: 37347
diff changeset
66 *
fbb9041f0c01 facebook: added missing GTK-Doc description
James Geboski <jgeboski@gmail.com>
parents: 37347
diff changeset
67 * The callback for requested buddies.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
68 */
37258
291b6e1acc24 facebook: implemented group chat support
James Geboski <jgeboski@gmail.com>
parents: 37250
diff changeset
69 typedef void (*FbUtilRequestBuddyFunc) (GSList *buddies, gpointer data);
291b6e1acc24 facebook: implemented group chat support
James Geboski <jgeboski@gmail.com>
parents: 37250
diff changeset
70
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
71 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
72 * FbUtilDebugFlags:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
73 * @FB_UTIL_DEBUG_FLAG_UNSAFE: The message is unsafe.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
74 * @FB_UTIL_DEBUG_FLAG_VERBOSE: The message is verbose.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
75 * @FB_UTIL_DEBUG_FLAG_ALL: All of the flags.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
76 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
77 * The debugging message flags. These flags are inserted on top of
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
78 * a #PurpleDebugLevel.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
79 */
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
80 typedef enum
37278
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
81 {
37359
79374d83fae5 facebook: removed alignment whitespace
James Geboski <jgeboski@gmail.com>
parents: 37358
diff changeset
82 FB_UTIL_DEBUG_FLAG_UNSAFE = 1 << 25,
37289
fb6acaae2788 facebook: fixed broken logging from invalid level
James Geboski <jgeboski@gmail.com>
parents: 37284
diff changeset
83 FB_UTIL_DEBUG_FLAG_VERBOSE = 1 << 26,
37359
79374d83fae5 facebook: removed alignment whitespace
James Geboski <jgeboski@gmail.com>
parents: 37358
diff changeset
84 FB_UTIL_DEBUG_FLAG_ALL = 3 << 25
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
85 } FbUtilDebugFlags;
37278
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
86
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
87 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
88 * FbUtilError:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
89 * @FB_UTIL_ERROR_GENERAL: General failure.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
90 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
91 * The error codes for the #FB_UTIL_ERROR domain.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
92 */
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
93 typedef enum
37284
53cb588d8760 facebook: implemented kicking/leaving group chats
James Geboski <jgeboski@gmail.com>
parents: 37278
diff changeset
94 {
53cb588d8760 facebook: implemented kicking/leaving group chats
James Geboski <jgeboski@gmail.com>
parents: 37278
diff changeset
95 FB_UTIL_ERROR_GENERAL
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
96 } FbUtilError;
37284
53cb588d8760 facebook: implemented kicking/leaving group chats
James Geboski <jgeboski@gmail.com>
parents: 37278
diff changeset
97
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
98 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
99 * fb_util_error_quark:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
100 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
101 * Gets the #GQuark of the domain of utility errors.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
102 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
103 * Returns: The #GQuark of the domain.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
104 */
37284
53cb588d8760 facebook: implemented kicking/leaving group chats
James Geboski <jgeboski@gmail.com>
parents: 37278
diff changeset
105 GQuark
53cb588d8760 facebook: implemented kicking/leaving group chats
James Geboski <jgeboski@gmail.com>
parents: 37278
diff changeset
106 fb_util_error_quark(void);
53cb588d8760 facebook: implemented kicking/leaving group chats
James Geboski <jgeboski@gmail.com>
parents: 37278
diff changeset
107
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
108 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
109 * fb_util_account_find_buddy:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
110 * @acct: The #PurpleAccount.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
111 * @chat: The #PurpleChatConversation.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
112 * @name: The name of the buddy.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37414
diff changeset
113 * @error: The return location for the #GError or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
114 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
115 * Finds a buddy by their name or alias.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
116 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
117 * Returns: The #PurpleBuddy if found, otherwise #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
118 */
37284
53cb588d8760 facebook: implemented kicking/leaving group chats
James Geboski <jgeboski@gmail.com>
parents: 37278
diff changeset
119 PurpleBuddy *
53cb588d8760 facebook: implemented kicking/leaving group chats
James Geboski <jgeboski@gmail.com>
parents: 37278
diff changeset
120 fb_util_account_find_buddy(PurpleAccount *acct, PurpleChatConversation *chat,
53cb588d8760 facebook: implemented kicking/leaving group chats
James Geboski <jgeboski@gmail.com>
parents: 37278
diff changeset
121 const gchar *name, GError **error);
53cb588d8760 facebook: implemented kicking/leaving group chats
James Geboski <jgeboski@gmail.com>
parents: 37278
diff changeset
122
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
123 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
124 * fb_util_debug:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
125 * @level: The #PurpleDebugLevel.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
126 * @format: The format string literal.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
127 * @...: The arguments for @format.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
128 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
129 * Logs a debugging message. If the messages is unsafe or verbose,
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
130 * apply the appropriate #FbUtilDebugFlags.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
131 */
37278
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
132 void
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
133 fb_util_debug(PurpleDebugLevel level, const gchar *format, ...)
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
134 G_GNUC_PRINTF(2, 3);
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
135
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
136 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
137 * fb_util_vdebug:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
138 * @level: The #PurpleDebugLevel.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
139 * @format: The format string literal.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
140 * @ap: The #va_list.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
141 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
142 * Logs a debugging message. If the messages is unsafe or verbose,
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
143 * apply the appropriate #FbUtilDebugFlags.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
144 */
37278
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
145 void
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
146 fb_util_vdebug(PurpleDebugLevel level, const gchar *format, va_list ap);
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
147
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
148 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
149 * fb_util_debug_misc:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
150 * @format: The format string literal.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
151 * @...: The arguments for @format.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
152 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
153 * Logs a debugging message with the level of #PURPLE_DEBUG_MISC.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
154 */
37278
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
155 void
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
156 fb_util_debug_misc(const gchar *format, ...)
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
157 G_GNUC_PRINTF(1, 2);
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
158
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
159 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
160 * fb_util_debug_info:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
161 * @format: The format string literal.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
162 * @...: The arguments for @format.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
163 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
164 * Logs a debugging message with the level of #PURPLE_DEBUG_INFO.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
165 */
37278
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
166 void
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
167 fb_util_debug_info(const gchar *format, ...)
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
168 G_GNUC_PRINTF(1, 2);
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
169
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
170 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
171 * fb_util_debug_warning:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
172 * @format: The format string literal.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
173 * @...: The arguments for @format.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
174 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
175 * Logs a debugging message with the level of #PURPLE_DEBUG_WARNING.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
176 */
37278
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
177 void
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
178 fb_util_debug_warning(const gchar *format, ...)
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
179 G_GNUC_PRINTF(1, 2);
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
180
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
181 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
182 * fb_util_debug_error:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
183 * @format: The format string literal.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
184 * @...: The arguments for @format.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
185 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
186 * Logs a debugging message with the level of #PURPLE_DEBUG_ERROR.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
187 */
37278
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
188 void
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
189 fb_util_debug_error(const gchar *format, ...)
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
190 G_GNUC_PRINTF(1, 2);
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
191
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
192 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
193 * fb_util_debug_fatal:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
194 * @format: The format string literal.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
195 * @...: The arguments for @format.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
196 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
197 * Logs a debugging message with the level of #PURPLE_DEBUG_FATAL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
198 */
37278
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
199 void
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
200 fb_util_debug_fatal(const gchar *format, ...)
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
201 G_GNUC_PRINTF(1, 2);
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
202
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
203 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
204 * fb_util_debug_hexdump:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
205 * @level: The #PurpleDebugLevel.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
206 * @bytes: The #GByteArray.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
207 * @format: The format string literal.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
208 * @...: The arguments for @format.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
209 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
210 * Logs a hexdump of a #GByteArray. If the messages is unsafe or
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
211 * verbose, apply the appropriate #FbUtilDebugFlags.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
212 */
37278
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
213 void
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
214 fb_util_debug_hexdump(PurpleDebugLevel level, const GByteArray *bytes,
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
215 const gchar *format, ...)
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
216 G_GNUC_PRINTF(3, 4);
3ee1b27dacc4 facebook: added debugging utilities and messages
James Geboski <jgeboski@gmail.com>
parents: 37265
diff changeset
217
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
218 /**
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
219 * fb_util_get_locale:
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
220 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
221 * Gets the locale string (ex: en_US) from the system. The returned
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
222 * string should be freed with #g_free() when no longer needed.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
223 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
224 * Returns: The locale string.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
225 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
226 gchar *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
227 fb_util_get_locale(void);
37260
473934b0c408 facebook: use working locale language
James Geboski <jgeboski@gmail.com>
parents: 37258
diff changeset
228
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
229 /**
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
230 * fb_util_rand_alnum:
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
231 * @len: The length of the string.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
232 *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
233 * Gets a random alphanumeric (A-Za-z0-9) string. This function should
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
234 * *not* be relied on for cryptographic operations. The returned string
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
235 * should be freed with #g_free() when no longer needed.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
236 *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
237 * Returns: The alphanumeric string.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
238 */
37260
473934b0c408 facebook: use working locale language
James Geboski <jgeboski@gmail.com>
parents: 37258
diff changeset
239 gchar *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
240 fb_util_rand_alnum(guint len);
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
241
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
242 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
243 * fb_util_request_buddy:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
244 * @gc: The #PurpleConnection.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
245 * @title: The title of the message or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
246 * @primary: The main point of the message or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
247 * @secondary: The secondary information or #NULL.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37414
diff changeset
248 * @select: A #GSList of selected buddies or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
249 * @multi: #TRUE to for multiple buddy selections, otherwise #FALSE.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
250 * @ok_cb: The callback for the `OK` button or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
251 * @cancel_cb: The callback for the `Cancel` button or #NULL.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
252 * @data: The user-defined data.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
253 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
254 * Displays a buddy list selection form.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
255 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
256 * Returns: The UI-specific handle.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
257 */
37258
291b6e1acc24 facebook: implemented group chat support
James Geboski <jgeboski@gmail.com>
parents: 37250
diff changeset
258 gpointer
291b6e1acc24 facebook: implemented group chat support
James Geboski <jgeboski@gmail.com>
parents: 37250
diff changeset
259 fb_util_request_buddy(PurpleConnection *gc, const gchar *title,
291b6e1acc24 facebook: implemented group chat support
James Geboski <jgeboski@gmail.com>
parents: 37250
diff changeset
260 const gchar *primary, const gchar *secondary,
291b6e1acc24 facebook: implemented group chat support
James Geboski <jgeboski@gmail.com>
parents: 37250
diff changeset
261 GSList *select, gboolean multi, GCallback ok_cb,
291b6e1acc24 facebook: implemented group chat support
James Geboski <jgeboski@gmail.com>
parents: 37250
diff changeset
262 GCallback cancel_cb, gpointer data);
291b6e1acc24 facebook: implemented group chat support
James Geboski <jgeboski@gmail.com>
parents: 37250
diff changeset
263
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
264 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
265 * fb_util_serv_got_im:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
266 * @gc: The #PurpleConnection.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
267 * @who: The message sender or receiver.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
268 * @text: The message text.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
269 * @flags: The #PurpleMessageFlags.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
270 * @timestamp: The message timestamp.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
271 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
272 * Handles an incoming IM message. This function is special in that it
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
273 * handles self messages. This function determines the direction of the
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
274 * message from the #PurpleMessageFlags.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
275 */
37317
143a4d8db15c facebook: implemented self messages
James Geboski <jgeboski@gmail.com>
parents: 37310
diff changeset
276 void
143a4d8db15c facebook: implemented self messages
James Geboski <jgeboski@gmail.com>
parents: 37310
diff changeset
277 fb_util_serv_got_im(PurpleConnection *gc, const gchar *who, const gchar *text,
143a4d8db15c facebook: implemented self messages
James Geboski <jgeboski@gmail.com>
parents: 37310
diff changeset
278 PurpleMessageFlags flags, guint64 timestamp);
143a4d8db15c facebook: implemented self messages
James Geboski <jgeboski@gmail.com>
parents: 37310
diff changeset
279
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
280 /**
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
281 * fb_util_serv_got_chat_in:
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
282 * @gc: The #PurpleConnection.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
283 * @id: The id of the chat.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
284 * @who: The message sender or receiver.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
285 * @text: The message text.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
286 * @flags: The #PurpleMessageFlags.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
287 * @timestamp: The message timestamp.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
288 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
289 * Handles an incoming chat message. This function is special in that
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
290 * it handles self messages. This function determines the direction of
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
291 * the message from the #PurpleMessageFlags.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
292 */
37317
143a4d8db15c facebook: implemented self messages
James Geboski <jgeboski@gmail.com>
parents: 37310
diff changeset
293 void
143a4d8db15c facebook: implemented self messages
James Geboski <jgeboski@gmail.com>
parents: 37310
diff changeset
294 fb_util_serv_got_chat_in(PurpleConnection *gc, gint id, const gchar *who,
143a4d8db15c facebook: implemented self messages
James Geboski <jgeboski@gmail.com>
parents: 37310
diff changeset
295 const gchar *text, PurpleMessageFlags flags,
143a4d8db15c facebook: implemented self messages
James Geboski <jgeboski@gmail.com>
parents: 37310
diff changeset
296 guint64 timestamp);
143a4d8db15c facebook: implemented self messages
James Geboski <jgeboski@gmail.com>
parents: 37310
diff changeset
297
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
298 /**
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
299 * fb_util_strtest:
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
300 * @str: The string.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
301 * @type: The #GAsciiType.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
302 *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
303 * Tests if the string only contains characters allowed by the
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
304 * #GAsciiType. More than one type can be specified by ORing the types
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
305 * together.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
306 *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
307 * Returns: #TRUE if the string only contains characters allowed by the
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
308 * #GAsciiType, otherwise #FALSE.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
309 */
37258
291b6e1acc24 facebook: implemented group chat support
James Geboski <jgeboski@gmail.com>
parents: 37250
diff changeset
310 gboolean
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
311 fb_util_strtest(const gchar *str, GAsciiType type);
37258
291b6e1acc24 facebook: implemented group chat support
James Geboski <jgeboski@gmail.com>
parents: 37250
diff changeset
312
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
313 /**
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
314 * fb_util_zlib_test:
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
315 * @bytes: The #GByteArray.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
316 *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
317 * Tests if the #GByteArray is zlib compressed.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
318 *
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
319 * Returns: #TRUE if the #GByteArray is compressed, otherwise #FALSE.
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
320 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
321 gboolean
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
322 fb_util_zlib_test(const GByteArray *bytes);
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
323
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
324 /**
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
325 * fb_util_zlib_deflate:
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
326 * @bytes: The #GByteArray.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37414
diff changeset
327 * @error: The return location for the #GError or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
328 *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
329 * Deflates a #GByteArray with zlib. The returned #GByteArray should be
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
330 * freed with #g_byte_array_free() when no longer needed.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
331 *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
332 * Returns: The deflated #GByteArray or #NULL on error.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
333 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
334 GByteArray *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
335 fb_util_zlib_deflate(const GByteArray *bytes, GError **error);
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
336
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
337 /**
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
338 * fb_util_zlib_inflate:
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
339 * @bytes: The #GByteArray.
37415
a06ade737f26 facebook: fixed grammar errors in the GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37414
diff changeset
340 * @error: The return location for the #GError or #NULL.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
341 *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
342 * Inflates a #GByteArray with zlib. The returned #GByteArray should be
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
343 * freed with #g_byte_array_free() when no longer needed.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
344 *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
345 * Returns: The inflated #GByteArray or #NULL on error.
37347
34d43f8c10d1 facebook: added GTK-Doc for the internal APIs
James Geboski <jgeboski@gmail.com>
parents: 37317
diff changeset
346 */
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
347 GByteArray *
37416
77536a48b4be facebook: refactored util naming and GTK-Doc
James Geboski <jgeboski@gmail.com>
parents: 37415
diff changeset
348 fb_util_zlib_inflate(const GByteArray *bytes, GError **error);
37250
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
349
3f5570a17b15 facebook: initial import of bitlbee-facebook
James Geboski <jgeboski@gmail.com>
parents:
diff changeset
350 #endif /* _FACEBOOK_UTIL_H_ */

mercurial