|
Evan@653
|
1 |
/** |
|
Evan@653
|
2 |
* @file conversation.h Conversation API |
|
Evan@653
|
3 |
* @ingroup core |
|
Evan@653
|
4 |
* @see @ref conversation-signals |
|
Evan@653
|
5 |
*/ |
|
Evan@653
|
6 |
|
|
Evan@653
|
7 |
/* purple |
|
Evan@653
|
8 |
* |
|
Evan@653
|
9 |
* Purple is the legal property of its developers, whose names are too numerous |
|
Evan@653
|
10 |
* to list here. Please refer to the COPYRIGHT file distributed with this |
|
Evan@653
|
11 |
* source distribution. |
|
Evan@653
|
12 |
* |
|
Evan@653
|
13 |
* This program is free software; you can redistribute it and/or modify |
|
Evan@653
|
14 |
* it under the terms of the GNU General Public License as published by |
|
Evan@653
|
15 |
* the Free Software Foundation; either version 2 of the License, or |
|
Evan@653
|
16 |
* (at your option) any later version. |
|
Evan@653
|
17 |
* |
|
Evan@653
|
18 |
* This program is distributed in the hope that it will be useful, |
|
Evan@653
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
Evan@653
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
Evan@653
|
21 |
* GNU General Public License for more details. |
|
Evan@653
|
22 |
* |
|
Evan@653
|
23 |
* You should have received a copy of the GNU General Public License |
|
Evan@653
|
24 |
* along with this program; if not, write to the Free Software |
|
Evan@653
|
25 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
Evan@653
|
26 |
*/ |
|
Evan@653
|
27 |
#ifndef _PURPLE_CONVERSATION_H_ |
|
Evan@653
|
28 |
#define _PURPLE_CONVERSATION_H_ |
|
Evan@653
|
29 |
|
|
Evan@653
|
30 |
/**************************************************************************/ |
|
Evan@653
|
31 |
/** Data Structures */ |
|
Evan@653
|
32 |
/**************************************************************************/ |
|
Evan@653
|
33 |
|
|
Evan@653
|
34 |
|
|
Evan@653
|
35 |
/** @copydoc _PurpleConversationUiOps */ |
|
Evan@653
|
36 |
typedef struct _PurpleConversationUiOps PurpleConversationUiOps; |
|
Evan@653
|
37 |
/** @copydoc _PurpleConversation */ |
|
Evan@653
|
38 |
typedef struct _PurpleConversation PurpleConversation; |
|
Evan@653
|
39 |
/** @copydoc _PurpleConvIm */ |
|
Evan@653
|
40 |
typedef struct _PurpleConvIm PurpleConvIm; |
|
Evan@653
|
41 |
/** @copydoc _PurpleConvChat */ |
|
Evan@653
|
42 |
typedef struct _PurpleConvChat PurpleConvChat; |
|
Evan@653
|
43 |
/** @copydoc _PurpleConvChatBuddy */ |
|
Evan@653
|
44 |
typedef struct _PurpleConvChatBuddy PurpleConvChatBuddy; |
|
Evan@653
|
45 |
/** @copydoc _PurpleConvMessage */ |
|
Evan@653
|
46 |
typedef struct _PurpleConvMessage PurpleConvMessage; |
|
Evan@653
|
47 |
|
|
Evan@653
|
48 |
/** |
|
Evan@653
|
49 |
* A type of conversation. |
|
Evan@653
|
50 |
*/ |
|
Evan@653
|
51 |
typedef enum |
|
Evan@653
|
52 |
{ |
|
Evan@653
|
53 |
PURPLE_CONV_TYPE_UNKNOWN = 0, /**< Unknown conversation type. */ |
|
Evan@653
|
54 |
PURPLE_CONV_TYPE_IM, /**< Instant Message. */ |
|
Evan@653
|
55 |
PURPLE_CONV_TYPE_CHAT, /**< Chat room. */ |
|
Evan@653
|
56 |
PURPLE_CONV_TYPE_MISC, /**< A misc. conversation. */ |
|
Evan@653
|
57 |
PURPLE_CONV_TYPE_ANY /**< Any type of conversation. */ |
|
Evan@653
|
58 |
|
|
Evan@653
|
59 |
} PurpleConversationType; |
|
Evan@653
|
60 |
|
|
Evan@653
|
61 |
/** |
|
Evan@653
|
62 |
* Conversation update type. |
|
Evan@653
|
63 |
*/ |
|
Evan@653
|
64 |
typedef enum |
|
Evan@653
|
65 |
{ |
|
Evan@653
|
66 |
PURPLE_CONV_UPDATE_ADD = 0, /**< The buddy associated with the conversation |
|
Evan@653
|
67 |
was added. */ |
|
Evan@653
|
68 |
PURPLE_CONV_UPDATE_REMOVE, /**< The buddy associated with the conversation |
|
Evan@653
|
69 |
was removed. */ |
|
Evan@653
|
70 |
PURPLE_CONV_UPDATE_ACCOUNT, /**< The purple_account was changed. */ |
|
Evan@653
|
71 |
PURPLE_CONV_UPDATE_TYPING, /**< The typing state was updated. */ |
|
Evan@653
|
72 |
PURPLE_CONV_UPDATE_UNSEEN, /**< The unseen state was updated. */ |
|
Evan@653
|
73 |
PURPLE_CONV_UPDATE_LOGGING, /**< Logging for this conversation was |
|
Evan@653
|
74 |
enabled or disabled. */ |
|
Evan@653
|
75 |
PURPLE_CONV_UPDATE_TOPIC, /**< The topic for a chat was updated. */ |
|
Evan@653
|
76 |
/* |
|
Evan@653
|
77 |
* XXX These need to go when we implement a more generic core/UI event |
|
Evan@653
|
78 |
* system. |
|
Evan@653
|
79 |
*/ |
|
Evan@653
|
80 |
PURPLE_CONV_ACCOUNT_ONLINE, /**< One of the user's accounts went online. */ |
|
Evan@653
|
81 |
PURPLE_CONV_ACCOUNT_OFFLINE, /**< One of the user's accounts went offline. */ |
|
Evan@653
|
82 |
PURPLE_CONV_UPDATE_AWAY, /**< The other user went away. */ |
|
Evan@653
|
83 |
PURPLE_CONV_UPDATE_ICON, /**< The other user's buddy icon changed. */ |
|
Evan@653
|
84 |
PURPLE_CONV_UPDATE_TITLE, |
|
Evan@653
|
85 |
PURPLE_CONV_UPDATE_CHATLEFT, |
|
Evan@653
|
86 |
|
|
Evan@653
|
87 |
PURPLE_CONV_UPDATE_FEATURES /**< The features for a chat have changed */ |
|
Evan@653
|
88 |
|
|
Evan@653
|
89 |
} PurpleConvUpdateType; |
|
Evan@653
|
90 |
|
|
Evan@653
|
91 |
/** |
|
Evan@653
|
92 |
* The typing state of a user. |
|
Evan@653
|
93 |
*/ |
|
Evan@653
|
94 |
typedef enum |
|
Evan@653
|
95 |
{ |
|
Evan@653
|
96 |
PURPLE_NOT_TYPING = 0, /**< Not typing. */ |
|
Evan@653
|
97 |
PURPLE_TYPING, /**< Currently typing. */ |
|
Evan@653
|
98 |
PURPLE_TYPED /**< Stopped typing momentarily. */ |
|
Evan@653
|
99 |
|
|
Evan@653
|
100 |
} PurpleTypingState; |
|
Evan@653
|
101 |
|
|
Evan@653
|
102 |
/** |
|
Evan@653
|
103 |
* Flags applicable to a message. Most will have send, recv or system. |
|
Evan@653
|
104 |
*/ |
|
Evan@653
|
105 |
typedef enum |
|
Evan@653
|
106 |
{ |
|
Evan@653
|
107 |
PURPLE_MESSAGE_SEND = 0x0001, /**< Outgoing message. */ |
|
Evan@653
|
108 |
PURPLE_MESSAGE_RECV = 0x0002, /**< Incoming message. */ |
|
Evan@653
|
109 |
PURPLE_MESSAGE_SYSTEM = 0x0004, /**< System message. */ |
|
Evan@653
|
110 |
PURPLE_MESSAGE_AUTO_RESP = 0x0008, /**< Auto response. */ |
|
Evan@653
|
111 |
PURPLE_MESSAGE_ACTIVE_ONLY = 0x0010, /**< Hint to the UI that this |
|
Evan@653
|
112 |
message should not be |
|
Evan@653
|
113 |
shown in conversations |
|
Evan@653
|
114 |
which are only open for |
|
Evan@653
|
115 |
internal UI purposes |
|
Evan@653
|
116 |
(e.g. for contact-aware |
|
Evan@653
|
117 |
conversations). */ |
|
Evan@653
|
118 |
PURPLE_MESSAGE_NICK = 0x0020, /**< Contains your nick. */ |
|
Evan@653
|
119 |
PURPLE_MESSAGE_NO_LOG = 0x0040, /**< Do not log. */ |
|
Evan@653
|
120 |
PURPLE_MESSAGE_WHISPER = 0x0080, /**< Whispered message. */ |
|
Evan@653
|
121 |
PURPLE_MESSAGE_ERROR = 0x0200, /**< Error message. */ |
|
Evan@653
|
122 |
PURPLE_MESSAGE_DELAYED = 0x0400, /**< Delayed message. */ |
|
Evan@653
|
123 |
PURPLE_MESSAGE_RAW = 0x0800, /**< "Raw" message - don't |
|
Evan@653
|
124 |
apply formatting */ |
|
Evan@653
|
125 |
PURPLE_MESSAGE_IMAGES = 0x1000, /**< Message contains images */ |
|
Evan@653
|
126 |
PURPLE_MESSAGE_NOTIFY = 0x2000, /**< Message is a notification */ |
|
Evan@653
|
127 |
PURPLE_MESSAGE_NO_LINKIFY = 0x4000, /**< Message should not be auto- |
|
Evan@653
|
128 |
linkified @since 2.1.0 */ |
|
Evan@653
|
129 |
PURPLE_MESSAGE_INVISIBLE = 0x8000 /**< Message should not be displayed */ |
|
Evan@653
|
130 |
} PurpleMessageFlags; |
|
Evan@653
|
131 |
|
|
Evan@653
|
132 |
/** |
|
Evan@653
|
133 |
* Flags applicable to users in Chats. |
|
Evan@653
|
134 |
*/ |
|
Evan@653
|
135 |
typedef enum |
|
Evan@653
|
136 |
{ |
|
Evan@653
|
137 |
PURPLE_CBFLAGS_NONE = 0x0000, /**< No flags */ |
|
Evan@653
|
138 |
PURPLE_CBFLAGS_VOICE = 0x0001, /**< Voiced user or "Participant" */ |
|
Evan@653
|
139 |
PURPLE_CBFLAGS_HALFOP = 0x0002, /**< Half-op */ |
|
Evan@653
|
140 |
PURPLE_CBFLAGS_OP = 0x0004, /**< Channel Op or Moderator */ |
|
Evan@653
|
141 |
PURPLE_CBFLAGS_FOUNDER = 0x0008, /**< Channel Founder */ |
|
zacw@1741
|
142 |
PURPLE_CBFLAGS_TYPING = 0x0010, /**< Currently typing */ |
|
zacw@1741
|
143 |
PURPLE_CBFLAGS_AWAY = 0x0020 /**< Currently away */ |
|
Evan@653
|
144 |
} PurpleConvChatBuddyFlags; |
|
Evan@653
|
145 |
|
|
Evan@653
|
146 |
#include "account.h" |
|
Evan@653
|
147 |
#include "buddyicon.h" |
|
Evan@653
|
148 |
#include "log.h" |
|
Evan@653
|
149 |
#include "server.h" |
|
Evan@653
|
150 |
|
|
Evan@653
|
151 |
/** |
|
Evan@653
|
152 |
* Conversation operations and events. |
|
Evan@653
|
153 |
* |
|
Evan@653
|
154 |
* Any UI representing a conversation must assign a filled-out |
|
Evan@653
|
155 |
* PurpleConversationUiOps structure to the PurpleConversation. |
|
Evan@653
|
156 |
*/ |
|
Evan@653
|
157 |
struct _PurpleConversationUiOps |
|
Evan@653
|
158 |
{ |
|
Evan@653
|
159 |
/** Called when @a conv is created (but before the @ref |
|
Evan@653
|
160 |
* conversation-created signal is emitted). |
|
Evan@653
|
161 |
*/ |
|
Evan@653
|
162 |
void (*create_conversation)(PurpleConversation *conv); |
|
Evan@653
|
163 |
|
|
Evan@653
|
164 |
/** Called just before @a conv is freed. */ |
|
Evan@653
|
165 |
void (*destroy_conversation)(PurpleConversation *conv); |
|
Evan@653
|
166 |
/** Write a message to a chat. If this field is @c NULL, libpurple will |
|
Evan@653
|
167 |
* fall back to using #write_conv. |
|
Evan@653
|
168 |
* @see purple_conv_chat_write() |
|
Evan@653
|
169 |
*/ |
|
Evan@653
|
170 |
void (*write_chat)(PurpleConversation *conv, const char *who, |
|
Evan@653
|
171 |
const char *message, PurpleMessageFlags flags, |
|
Evan@653
|
172 |
time_t mtime); |
|
Evan@653
|
173 |
/** Write a message to an IM conversation. If this field is @c NULL, |
|
Evan@653
|
174 |
* libpurple will fall back to using #write_conv. |
|
Evan@653
|
175 |
* @see purple_conv_im_write() |
|
Evan@653
|
176 |
*/ |
|
Evan@653
|
177 |
void (*write_im)(PurpleConversation *conv, const char *who, |
|
Evan@653
|
178 |
const char *message, PurpleMessageFlags flags, |
|
Evan@653
|
179 |
time_t mtime); |
|
Evan@653
|
180 |
/** Write a message to a conversation. This is used rather than the |
|
Evan@653
|
181 |
* chat- or im-specific ops for errors, system messages (such as "x is |
|
Evan@653
|
182 |
* now know as y"), and as the fallback if #write_im and #write_chat |
|
Evan@653
|
183 |
* are not implemented. It should be implemented, or the UI will miss |
|
Evan@653
|
184 |
* conversation error messages and your users will hate you. |
|
Evan@653
|
185 |
* |
|
Evan@653
|
186 |
* @see purple_conversation_write() |
|
Evan@653
|
187 |
*/ |
|
Evan@653
|
188 |
void (*write_conv)(PurpleConversation *conv, |
|
Evan@653
|
189 |
const char *name, |
|
Evan@653
|
190 |
const char *alias, |
|
Evan@653
|
191 |
const char *message, |
|
Evan@653
|
192 |
PurpleMessageFlags flags, |
|
Evan@653
|
193 |
time_t mtime); |
|
Evan@653
|
194 |
|
|
Evan@653
|
195 |
/** Add @a cbuddies to a chat. |
|
Evan@653
|
196 |
* @param cbuddies A @c GList of #PurpleConvChatBuddy structs. |
|
Evan@653
|
197 |
* @param new_arrivals Whether join notices should be shown. |
|
Evan@653
|
198 |
* (Join notices are actually written to the |
|
Evan@653
|
199 |
* conversation by #purple_conv_chat_add_users().) |
|
Evan@653
|
200 |
*/ |
|
Evan@653
|
201 |
void (*chat_add_users)(PurpleConversation *conv, |
|
Evan@653
|
202 |
GList *cbuddies, |
|
Evan@653
|
203 |
gboolean new_arrivals); |
|
Evan@653
|
204 |
/** Rename the user in this chat named @a old_name to @a new_name. (The |
|
Evan@653
|
205 |
* rename message is written to the conversation by libpurple.) |
|
Evan@653
|
206 |
* @param new_alias @a new_name's new alias, if they have one. |
|
Evan@653
|
207 |
* @see purple_conv_chat_add_users() |
|
Evan@653
|
208 |
*/ |
|
Evan@653
|
209 |
void (*chat_rename_user)(PurpleConversation *conv, const char *old_name, |
|
Evan@653
|
210 |
const char *new_name, const char *new_alias); |
|
Evan@653
|
211 |
/** Remove @a users from a chat. |
|
Evan@653
|
212 |
* @param users A @c GList of <tt>const char *</tt>s. |
|
Evan@653
|
213 |
* @see purple_conv_chat_rename_user() |
|
Evan@653
|
214 |
*/ |
|
Evan@653
|
215 |
void (*chat_remove_users)(PurpleConversation *conv, GList *users); |
|
Evan@653
|
216 |
/** Called when a user's flags are changed. |
|
Evan@653
|
217 |
* @see purple_conv_chat_user_set_flags() |
|
Evan@653
|
218 |
*/ |
|
Evan@653
|
219 |
void (*chat_update_user)(PurpleConversation *conv, const char *user); |
|
Evan@653
|
220 |
|
|
Evan@653
|
221 |
/** Present this conversation to the user; for example, by displaying |
|
Evan@653
|
222 |
* the IM dialog. |
|
Evan@653
|
223 |
*/ |
|
Evan@653
|
224 |
void (*present)(PurpleConversation *conv); |
|
Evan@653
|
225 |
|
|
Evan@653
|
226 |
/** If this UI has a concept of focus (as in a windowing system) and |
|
Evan@653
|
227 |
* this conversation has the focus, return @c TRUE; otherwise, return |
|
Evan@653
|
228 |
* @c FALSE. |
|
Evan@653
|
229 |
*/ |
|
Evan@653
|
230 |
gboolean (*has_focus)(PurpleConversation *conv); |
|
Evan@653
|
231 |
|
|
Evan@653
|
232 |
/* Custom Smileys */ |
|
Evan@653
|
233 |
gboolean (*custom_smiley_add)(PurpleConversation *conv, const char *smile, gboolean remote); |
|
Evan@653
|
234 |
void (*custom_smiley_write)(PurpleConversation *conv, const char *smile, |
|
Evan@653
|
235 |
const guchar *data, gsize size); |
|
Evan@653
|
236 |
void (*custom_smiley_close)(PurpleConversation *conv, const char *smile); |
|
Evan@653
|
237 |
|
|
Evan@653
|
238 |
/** Prompt the user for confirmation to send @a message. This function |
|
Evan@653
|
239 |
* should arrange for the message to be sent if the user accepts. If |
|
Evan@653
|
240 |
* this field is @c NULL, libpurple will fall back to using |
|
Evan@653
|
241 |
* #purple_request_action(). |
|
Evan@653
|
242 |
*/ |
|
Evan@653
|
243 |
void (*send_confirm)(PurpleConversation *conv, const char *message); |
|
Evan@653
|
244 |
|
|
Evan@653
|
245 |
void (*_purple_reserved1)(void); |
|
Evan@653
|
246 |
void (*_purple_reserved2)(void); |
|
Evan@653
|
247 |
void (*_purple_reserved3)(void); |
|
Evan@653
|
248 |
void (*_purple_reserved4)(void); |
|
Evan@653
|
249 |
}; |
|
Evan@653
|
250 |
|
|
Evan@653
|
251 |
/** |
|
Evan@653
|
252 |
* Data specific to Instant Messages. |
|
Evan@653
|
253 |
*/ |
|
Evan@653
|
254 |
struct _PurpleConvIm |
|
Evan@653
|
255 |
{ |
|
Evan@653
|
256 |
PurpleConversation *conv; /**< The parent conversation. */ |
|
Evan@653
|
257 |
|
|
Evan@653
|
258 |
PurpleTypingState typing_state; /**< The current typing state. */ |
|
Evan@653
|
259 |
guint typing_timeout; /**< The typing timer handle. */ |
|
Evan@653
|
260 |
time_t type_again; /**< The type again time. */ |
|
Evan@653
|
261 |
guint send_typed_timeout; /**< The type again timer handle. */ |
|
Evan@653
|
262 |
|
|
Evan@653
|
263 |
PurpleBuddyIcon *icon; /**< The buddy icon. */ |
|
Evan@653
|
264 |
}; |
|
Evan@653
|
265 |
|
|
Evan@653
|
266 |
/** |
|
Evan@653
|
267 |
* Data specific to Chats. |
|
Evan@653
|
268 |
*/ |
|
Evan@653
|
269 |
struct _PurpleConvChat |
|
Evan@653
|
270 |
{ |
|
Evan@653
|
271 |
PurpleConversation *conv; /**< The parent conversation. */ |
|
Evan@653
|
272 |
|
|
Evan@653
|
273 |
GList *in_room; /**< The users in the room. */ |
|
Evan@653
|
274 |
GList *ignored; /**< Ignored users. */ |
|
Evan@653
|
275 |
char *who; /**< The person who set the topic. */ |
|
Evan@653
|
276 |
char *topic; /**< The topic. */ |
|
Evan@653
|
277 |
int id; /**< The chat ID. */ |
|
Evan@653
|
278 |
char *nick; /**< Your nick in this chat. */ |
|
Evan@653
|
279 |
|
|
Evan@653
|
280 |
gboolean left; /**< We left the chat and kept the window open */ |
|
Evan@653
|
281 |
}; |
|
Evan@653
|
282 |
|
|
Evan@653
|
283 |
/** |
|
Evan@653
|
284 |
* Data for "Chat Buddies" |
|
Evan@653
|
285 |
*/ |
|
Evan@653
|
286 |
struct _PurpleConvChatBuddy |
|
Evan@653
|
287 |
{ |
|
Evan@653
|
288 |
char *name; /**< The chat participant's name in the chat. */ |
|
zacw@1776
|
289 |
char *collate_key; /**< A string by which this buddy can be compared with other collate keys. */ |
|
Evan@653
|
290 |
char *alias; /**< The chat participant's alias, if known; |
|
Evan@653
|
291 |
* @a NULL otherwise. |
|
Evan@653
|
292 |
*/ |
|
Evan@653
|
293 |
char *alias_key; /**< A string by which this buddy will be sorted, |
|
Evan@653
|
294 |
* or @c NULL if the buddy should be sorted by |
|
Evan@653
|
295 |
* its @c name. (This is currently always @c |
|
Evan@653
|
296 |
* NULL.) |
|
Evan@653
|
297 |
*/ |
|
Evan@653
|
298 |
gboolean buddy; /**< @a TRUE if this chat participant is on the |
|
Evan@653
|
299 |
* buddy list; @a FALSE otherwise. |
|
Evan@653
|
300 |
*/ |
|
Evan@653
|
301 |
PurpleConvChatBuddyFlags flags; /**< A bitwise OR of flags for this participant, |
|
Evan@653
|
302 |
* such as whether they are a channel operator. |
|
Evan@653
|
303 |
*/ |
|
zacw@1739
|
304 |
GHashTable *attributes; /**< A hash table of attributes about the user, such as |
|
zacw@1739
|
305 |
* real name, user@host, etc. |
|
zacw@1739
|
306 |
*/ |
|
Evan@653
|
307 |
}; |
|
Evan@653
|
308 |
|
|
Evan@653
|
309 |
/** |
|
Evan@653
|
310 |
* Description of a conversation message |
|
Evan@653
|
311 |
* |
|
Evan@653
|
312 |
* @since 2.2.0 |
|
Evan@653
|
313 |
*/ |
|
Evan@653
|
314 |
struct _PurpleConvMessage |
|
Evan@653
|
315 |
{ |
|
Evan@653
|
316 |
char *who; |
|
Evan@653
|
317 |
char *what; |
|
Evan@653
|
318 |
PurpleMessageFlags flags; |
|
Evan@653
|
319 |
time_t when; |
|
Evan@653
|
320 |
PurpleConversation *conv; /**< @since 2.3.0 */ |
|
Evan@653
|
321 |
char *alias; /**< @since 2.3.0 */ |
|
Evan@653
|
322 |
}; |
|
Evan@653
|
323 |
|
|
Evan@653
|
324 |
/** |
|
Evan@653
|
325 |
* A core representation of a conversation between two or more people. |
|
Evan@653
|
326 |
* |
|
Evan@653
|
327 |
* The conversation can be an IM or a chat. |
|
Evan@653
|
328 |
*/ |
|
Evan@653
|
329 |
struct _PurpleConversation |
|
Evan@653
|
330 |
{ |
|
Evan@653
|
331 |
PurpleConversationType type; /**< The type of conversation. */ |
|
Evan@653
|
332 |
|
|
Evan@653
|
333 |
PurpleAccount *account; /**< The user using this conversation. */ |
|
Evan@653
|
334 |
|
|
Evan@653
|
335 |
|
|
Evan@653
|
336 |
char *name; /**< The name of the conversation. */ |
|
Evan@653
|
337 |
char *title; /**< The window title. */ |
|
Evan@653
|
338 |
|
|
Evan@653
|
339 |
gboolean logging; /**< The status of logging. */ |
|
Evan@653
|
340 |
|
|
Evan@653
|
341 |
GList *logs; /**< This conversation's logs */ |
|
Evan@653
|
342 |
|
|
Evan@653
|
343 |
union |
|
Evan@653
|
344 |
{ |
|
Evan@653
|
345 |
PurpleConvIm *im; /**< IM-specific data. */ |
|
Evan@653
|
346 |
PurpleConvChat *chat; /**< Chat-specific data. */ |
|
Evan@653
|
347 |
void *misc; /**< Misc. data. */ |
|
Evan@653
|
348 |
|
|
Evan@653
|
349 |
} u; |
|
Evan@653
|
350 |
|
|
Evan@653
|
351 |
PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ |
|
Evan@653
|
352 |
void *ui_data; /**< UI-specific data. */ |
|
Evan@653
|
353 |
|
|
Evan@653
|
354 |
GHashTable *data; /**< Plugin-specific data. */ |
|
Evan@653
|
355 |
|
|
Evan@653
|
356 |
PurpleConnectionFlags features; /**< The supported features */ |
|
Evan@653
|
357 |
GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ |
|
Evan@653
|
358 |
}; |
|
Evan@653
|
359 |
|
|
Evan@653
|
360 |
#ifdef __cplusplus |
|
Evan@653
|
361 |
extern "C" { |
|
Evan@653
|
362 |
#endif |
|
Evan@653
|
363 |
|
|
Evan@653
|
364 |
/**************************************************************************/ |
|
Evan@653
|
365 |
/** @name Conversation API */ |
|
Evan@653
|
366 |
/**************************************************************************/ |
|
Evan@653
|
367 |
/*@{*/ |
|
Evan@653
|
368 |
|
|
Evan@653
|
369 |
/** |
|
Evan@653
|
370 |
* Creates a new conversation of the specified type. |
|
Evan@653
|
371 |
* |
|
Evan@653
|
372 |
* @param type The type of conversation. |
|
Evan@653
|
373 |
* @param account The account opening the conversation window on the purple |
|
Evan@653
|
374 |
* user's end. |
|
Evan@653
|
375 |
* @param name The name of the conversation. |
|
Evan@653
|
376 |
* |
|
Evan@653
|
377 |
* @return The new conversation. |
|
Evan@653
|
378 |
*/ |
|
Evan@653
|
379 |
PurpleConversation *purple_conversation_new(PurpleConversationType type, |
|
Evan@653
|
380 |
PurpleAccount *account, |
|
Evan@653
|
381 |
const char *name); |
|
Evan@653
|
382 |
|
|
Evan@653
|
383 |
/** |
|
Evan@653
|
384 |
* Destroys the specified conversation and removes it from the parent |
|
Evan@653
|
385 |
* window. |
|
Evan@653
|
386 |
* |
|
Evan@653
|
387 |
* If this conversation is the only one contained in the parent window, |
|
Evan@653
|
388 |
* that window is also destroyed. |
|
Evan@653
|
389 |
* |
|
Evan@653
|
390 |
* @param conv The conversation to destroy. |
|
Evan@653
|
391 |
*/ |
|
Evan@653
|
392 |
void purple_conversation_destroy(PurpleConversation *conv); |
|
Evan@653
|
393 |
|
|
Evan@653
|
394 |
|
|
Evan@653
|
395 |
/** |
|
Evan@653
|
396 |
* Present a conversation to the user. This allows core code to initiate a |
|
Evan@653
|
397 |
* conversation by displaying the IM dialog. |
|
Evan@653
|
398 |
* @param conv The conversation to present |
|
Evan@653
|
399 |
*/ |
|
Evan@653
|
400 |
void purple_conversation_present(PurpleConversation *conv); |
|
Evan@653
|
401 |
|
|
Evan@653
|
402 |
|
|
Evan@653
|
403 |
/** |
|
Evan@653
|
404 |
* Returns the specified conversation's type. |
|
Evan@653
|
405 |
* |
|
Evan@653
|
406 |
* @param conv The conversation. |
|
Evan@653
|
407 |
* |
|
Evan@653
|
408 |
* @return The conversation's type. |
|
Evan@653
|
409 |
*/ |
|
Evan@653
|
410 |
PurpleConversationType purple_conversation_get_type(const PurpleConversation *conv); |
|
Evan@653
|
411 |
|
|
Evan@653
|
412 |
/** |
|
Evan@653
|
413 |
* Sets the specified conversation's UI operations structure. |
|
Evan@653
|
414 |
* |
|
Evan@653
|
415 |
* @param conv The conversation. |
|
Evan@653
|
416 |
* @param ops The UI conversation operations structure. |
|
Evan@653
|
417 |
*/ |
|
Evan@653
|
418 |
void purple_conversation_set_ui_ops(PurpleConversation *conv, |
|
Evan@653
|
419 |
PurpleConversationUiOps *ops); |
|
Evan@653
|
420 |
|
|
Evan@653
|
421 |
/** |
|
Evan@653
|
422 |
* Sets the default conversation UI operations structure. |
|
Evan@653
|
423 |
* |
|
Evan@653
|
424 |
* @param ops The UI conversation operations structure. |
|
Evan@653
|
425 |
*/ |
|
Evan@653
|
426 |
void purple_conversations_set_ui_ops(PurpleConversationUiOps *ops); |
|
Evan@653
|
427 |
|
|
Evan@653
|
428 |
/** |
|
Evan@653
|
429 |
* Returns the specified conversation's UI operations structure. |
|
Evan@653
|
430 |
* |
|
Evan@653
|
431 |
* @param conv The conversation. |
|
Evan@653
|
432 |
* |
|
Evan@653
|
433 |
* @return The operations structure. |
|
Evan@653
|
434 |
*/ |
|
Evan@653
|
435 |
PurpleConversationUiOps *purple_conversation_get_ui_ops( |
|
Evan@653
|
436 |
const PurpleConversation *conv); |
|
Evan@653
|
437 |
|
|
Evan@653
|
438 |
/** |
|
Evan@653
|
439 |
* Sets the specified conversation's purple_account. |
|
Evan@653
|
440 |
* |
|
Evan@653
|
441 |
* This purple_account represents the user using purple, not the person the user |
|
Evan@653
|
442 |
* is having a conversation/chat/flame with. |
|
Evan@653
|
443 |
* |
|
Evan@653
|
444 |
* @param conv The conversation. |
|
Evan@653
|
445 |
* @param account The purple_account. |
|
Evan@653
|
446 |
*/ |
|
Evan@653
|
447 |
void purple_conversation_set_account(PurpleConversation *conv, |
|
Evan@653
|
448 |
PurpleAccount *account); |
|
Evan@653
|
449 |
|
|
Evan@653
|
450 |
/** |
|
Evan@653
|
451 |
* Returns the specified conversation's purple_account. |
|
Evan@653
|
452 |
* |
|
Evan@653
|
453 |
* This purple_account represents the user using purple, not the person the user |
|
Evan@653
|
454 |
* is having a conversation/chat/flame with. |
|
Evan@653
|
455 |
* |
|
Evan@653
|
456 |
* @param conv The conversation. |
|
Evan@653
|
457 |
* |
|
Evan@653
|
458 |
* @return The conversation's purple_account. |
|
Evan@653
|
459 |
*/ |
|
Evan@653
|
460 |
PurpleAccount *purple_conversation_get_account(const PurpleConversation *conv); |
|
Evan@653
|
461 |
|
|
Evan@653
|
462 |
/** |
|
Evan@653
|
463 |
* Returns the specified conversation's purple_connection. |
|
Evan@653
|
464 |
* |
|
Evan@653
|
465 |
* This is the same as purple_conversation_get_user(conv)->gc. |
|
Evan@653
|
466 |
* |
|
Evan@653
|
467 |
* @param conv The conversation. |
|
Evan@653
|
468 |
* |
|
Evan@653
|
469 |
* @return The conversation's purple_connection. |
|
Evan@653
|
470 |
*/ |
|
Evan@653
|
471 |
PurpleConnection *purple_conversation_get_gc(const PurpleConversation *conv); |
|
Evan@653
|
472 |
|
|
Evan@653
|
473 |
/** |
|
Evan@653
|
474 |
* Sets the specified conversation's title. |
|
Evan@653
|
475 |
* |
|
Evan@653
|
476 |
* @param conv The conversation. |
|
Evan@653
|
477 |
* @param title The title. |
|
Evan@653
|
478 |
*/ |
|
Evan@653
|
479 |
void purple_conversation_set_title(PurpleConversation *conv, const char *title); |
|
Evan@653
|
480 |
|
|
Evan@653
|
481 |
/** |
|
Evan@653
|
482 |
* Returns the specified conversation's title. |
|
Evan@653
|
483 |
* |
|
Evan@653
|
484 |
* @param conv The conversation. |
|
Evan@653
|
485 |
* |
|
Evan@653
|
486 |
* @return The title. |
|
Evan@653
|
487 |
*/ |
|
Evan@653
|
488 |
const char *purple_conversation_get_title(const PurpleConversation *conv); |
|
Evan@653
|
489 |
|
|
Evan@653
|
490 |
/** |
|
Evan@653
|
491 |
* Automatically sets the specified conversation's title. |
|
Evan@653
|
492 |
* |
|
Evan@653
|
493 |
* This function takes OPT_IM_ALIAS_TAB into account, as well as the |
|
Evan@653
|
494 |
* user's alias. |
|
Evan@653
|
495 |
* |
|
Evan@653
|
496 |
* @param conv The conversation. |
|
Evan@653
|
497 |
*/ |
|
Evan@653
|
498 |
void purple_conversation_autoset_title(PurpleConversation *conv); |
|
Evan@653
|
499 |
|
|
Evan@653
|
500 |
/** |
|
Evan@653
|
501 |
* Sets the specified conversation's name. |
|
Evan@653
|
502 |
* |
|
Evan@653
|
503 |
* @param conv The conversation. |
|
Evan@653
|
504 |
* @param name The conversation's name. |
|
Evan@653
|
505 |
*/ |
|
Evan@653
|
506 |
void purple_conversation_set_name(PurpleConversation *conv, const char *name); |
|
Evan@653
|
507 |
|
|
Evan@653
|
508 |
/** |
|
Evan@653
|
509 |
* Returns the specified conversation's name. |
|
Evan@653
|
510 |
* |
|
Evan@653
|
511 |
* @param conv The conversation. |
|
Evan@653
|
512 |
* |
|
Evan@653
|
513 |
* @return The conversation's name. If the conversation is an IM with a PurpleBuddy, |
|
Evan@653
|
514 |
* then it's the name of the PurpleBuddy. |
|
Evan@653
|
515 |
*/ |
|
Evan@653
|
516 |
const char *purple_conversation_get_name(const PurpleConversation *conv); |
|
Evan@653
|
517 |
|
|
Evan@653
|
518 |
/** |
|
Evan@653
|
519 |
* Enables or disables logging for this conversation. |
|
Evan@653
|
520 |
* |
|
Evan@653
|
521 |
* @param conv The conversation. |
|
Evan@653
|
522 |
* @param log @c TRUE if logging should be enabled, or @c FALSE otherwise. |
|
Evan@653
|
523 |
*/ |
|
Evan@653
|
524 |
void purple_conversation_set_logging(PurpleConversation *conv, gboolean log); |
|
Evan@653
|
525 |
|
|
Evan@653
|
526 |
/** |
|
Evan@653
|
527 |
* Returns whether or not logging is enabled for this conversation. |
|
Evan@653
|
528 |
* |
|
Evan@653
|
529 |
* @param conv The conversation. |
|
Evan@653
|
530 |
* |
|
Evan@653
|
531 |
* @return @c TRUE if logging is enabled, or @c FALSE otherwise. |
|
Evan@653
|
532 |
*/ |
|
Evan@653
|
533 |
gboolean purple_conversation_is_logging(const PurpleConversation *conv); |
|
Evan@653
|
534 |
|
|
Evan@653
|
535 |
/** |
|
Evan@653
|
536 |
* Closes any open logs for this conversation. |
|
Evan@653
|
537 |
* |
|
Evan@653
|
538 |
* Note that new logs will be opened as necessary (e.g. upon receipt of a |
|
Evan@653
|
539 |
* message, if the conversation has logging enabled. To disable logging for |
|
Evan@653
|
540 |
* the remainder of the conversation, use purple_conversation_set_logging(). |
|
Evan@653
|
541 |
* |
|
Evan@653
|
542 |
* @param conv The conversation. |
|
Evan@653
|
543 |
*/ |
|
Evan@653
|
544 |
void purple_conversation_close_logs(PurpleConversation *conv); |
|
Evan@653
|
545 |
|
|
Evan@653
|
546 |
/** |
|
Evan@653
|
547 |
* Returns the specified conversation's IM-specific data. |
|
Evan@653
|
548 |
* |
|
Evan@653
|
549 |
* If the conversation type is not PURPLE_CONV_TYPE_IM, this will return @c NULL. |
|
Evan@653
|
550 |
* |
|
Evan@653
|
551 |
* @param conv The conversation. |
|
Evan@653
|
552 |
* |
|
Evan@653
|
553 |
* @return The IM-specific data. |
|
Evan@653
|
554 |
*/ |
|
Evan@653
|
555 |
PurpleConvIm *purple_conversation_get_im_data(const PurpleConversation *conv); |
|
Evan@653
|
556 |
|
|
Evan@653
|
557 |
#define PURPLE_CONV_IM(c) (purple_conversation_get_im_data(c)) |
|
Evan@653
|
558 |
|
|
Evan@653
|
559 |
/** |
|
Evan@653
|
560 |
* Returns the specified conversation's chat-specific data. |
|
Evan@653
|
561 |
* |
|
Evan@653
|
562 |
* If the conversation type is not PURPLE_CONV_TYPE_CHAT, this will return @c NULL. |
|
Evan@653
|
563 |
* |
|
Evan@653
|
564 |
* @param conv The conversation. |
|
Evan@653
|
565 |
* |
|
Evan@653
|
566 |
* @return The chat-specific data. |
|
Evan@653
|
567 |
*/ |
|
Evan@653
|
568 |
PurpleConvChat *purple_conversation_get_chat_data(const PurpleConversation *conv); |
|
Evan@653
|
569 |
|
|
Evan@653
|
570 |
#define PURPLE_CONV_CHAT(c) (purple_conversation_get_chat_data(c)) |
|
Evan@653
|
571 |
|
|
Evan@653
|
572 |
/** |
|
Evan@653
|
573 |
* Sets extra data for a conversation. |
|
Evan@653
|
574 |
* |
|
Evan@653
|
575 |
* @param conv The conversation. |
|
Evan@653
|
576 |
* @param key The unique key. |
|
Evan@653
|
577 |
* @param data The data to assign. |
|
Evan@653
|
578 |
*/ |
|
Evan@653
|
579 |
void purple_conversation_set_data(PurpleConversation *conv, const char *key, |
|
Evan@653
|
580 |
gpointer data); |
|
Evan@653
|
581 |
|
|
Evan@653
|
582 |
/** |
|
Evan@653
|
583 |
* Returns extra data in a conversation. |
|
Evan@653
|
584 |
* |
|
Evan@653
|
585 |
* @param conv The conversation. |
|
Evan@653
|
586 |
* @param key The unqiue key. |
|
Evan@653
|
587 |
* |
|
Evan@653
|
588 |
* @return The data associated with the key. |
|
Evan@653
|
589 |
*/ |
|
Evan@653
|
590 |
gpointer purple_conversation_get_data(PurpleConversation *conv, const char *key); |
|
Evan@653
|
591 |
|
|
Evan@653
|
592 |
/** |
|
Evan@653
|
593 |
* Returns a list of all conversations. |
|
Evan@653
|
594 |
* |
|
Evan@653
|
595 |
* This list includes both IMs and chats. |
|
Evan@653
|
596 |
* |
|
Evan@653
|
597 |
* @constreturn A GList of all conversations. |
|
Evan@653
|
598 |
*/ |
|
Evan@653
|
599 |
GList *purple_get_conversations(void); |
|
Evan@653
|
600 |
|
|
Evan@653
|
601 |
/** |
|
Evan@653
|
602 |
* Returns a list of all IMs. |
|
Evan@653
|
603 |
* |
|
Evan@653
|
604 |
* @constreturn A GList of all IMs. |
|
Evan@653
|
605 |
*/ |
|
Evan@653
|
606 |
GList *purple_get_ims(void); |
|
Evan@653
|
607 |
|
|
Evan@653
|
608 |
/** |
|
Evan@653
|
609 |
* Returns a list of all chats. |
|
Evan@653
|
610 |
* |
|
Evan@653
|
611 |
* @constreturn A GList of all chats. |
|
Evan@653
|
612 |
*/ |
|
Evan@653
|
613 |
GList *purple_get_chats(void); |
|
Evan@653
|
614 |
|
|
Evan@653
|
615 |
/** |
|
Evan@653
|
616 |
* Finds a conversation with the specified type, name, and Purple account. |
|
Evan@653
|
617 |
* |
|
Evan@653
|
618 |
* @param type The type of the conversation. |
|
Evan@653
|
619 |
* @param name The name of the conversation. |
|
Evan@653
|
620 |
* @param account The purple_account associated with the conversation. |
|
Evan@653
|
621 |
* |
|
Evan@653
|
622 |
* @return The conversation if found, or @c NULL otherwise. |
|
Evan@653
|
623 |
*/ |
|
Evan@653
|
624 |
PurpleConversation *purple_find_conversation_with_account( |
|
Evan@653
|
625 |
PurpleConversationType type, const char *name, |
|
Evan@653
|
626 |
const PurpleAccount *account); |
|
Evan@653
|
627 |
|
|
Evan@653
|
628 |
/** |
|
Evan@653
|
629 |
* Writes to a conversation window. |
|
Evan@653
|
630 |
* |
|
Evan@653
|
631 |
* This function should not be used to write IM or chat messages. Use |
|
Evan@653
|
632 |
* purple_conv_im_write() and purple_conv_chat_write() instead. Those functions will |
|
Evan@653
|
633 |
* most likely call this anyway, but they may do their own formatting, |
|
Evan@653
|
634 |
* sound playback, etc. |
|
Evan@653
|
635 |
* |
|
Evan@653
|
636 |
* This can be used to write generic messages, such as "so and so closed |
|
Evan@653
|
637 |
* the conversation window." |
|
Evan@653
|
638 |
* |
|
Evan@653
|
639 |
* @param conv The conversation. |
|
Evan@653
|
640 |
* @param who The user who sent the message. |
|
Evan@653
|
641 |
* @param message The message. |
|
Evan@653
|
642 |
* @param flags The message flags. |
|
Evan@653
|
643 |
* @param mtime The time the message was sent. |
|
Evan@653
|
644 |
* |
|
Evan@653
|
645 |
* @see purple_conv_im_write() |
|
Evan@653
|
646 |
* @see purple_conv_chat_write() |
|
Evan@653
|
647 |
*/ |
|
Evan@653
|
648 |
void purple_conversation_write(PurpleConversation *conv, const char *who, |
|
Evan@653
|
649 |
const char *message, PurpleMessageFlags flags, |
|
Evan@653
|
650 |
time_t mtime); |
|
Evan@653
|
651 |
|
|
Evan@653
|
652 |
|
|
Evan@653
|
653 |
/** |
|
Evan@653
|
654 |
Set the features as supported for the given conversation. |
|
Evan@653
|
655 |
@param conv The conversation |
|
Evan@653
|
656 |
@param features Bitset defining supported features |
|
Evan@653
|
657 |
*/ |
|
Evan@653
|
658 |
void purple_conversation_set_features(PurpleConversation *conv, |
|
Evan@653
|
659 |
PurpleConnectionFlags features); |
|
Evan@653
|
660 |
|
|
Evan@653
|
661 |
|
|
Evan@653
|
662 |
/** |
|
Evan@653
|
663 |
Get the features supported by the given conversation. |
|
Evan@653
|
664 |
@param conv The conversation |
|
Evan@653
|
665 |
*/ |
|
Evan@653
|
666 |
PurpleConnectionFlags purple_conversation_get_features(PurpleConversation *conv); |
|
Evan@653
|
667 |
|
|
Evan@653
|
668 |
/** |
|
Evan@653
|
669 |
* Determines if a conversation has focus |
|
Evan@653
|
670 |
* |
|
Evan@653
|
671 |
* @param conv The conversation. |
|
Evan@653
|
672 |
* |
|
Evan@653
|
673 |
* @return @c TRUE if the conversation has focus, @c FALSE if |
|
Evan@653
|
674 |
* it does not or the UI does not have a concept of conversation focus |
|
Evan@653
|
675 |
*/ |
|
Evan@653
|
676 |
gboolean purple_conversation_has_focus(PurpleConversation *conv); |
|
Evan@653
|
677 |
|
|
Evan@653
|
678 |
/** |
|
Evan@653
|
679 |
* Updates the visual status and UI of a conversation. |
|
Evan@653
|
680 |
* |
|
Evan@653
|
681 |
* @param conv The conversation. |
|
Evan@653
|
682 |
* @param type The update type. |
|
Evan@653
|
683 |
*/ |
|
Evan@653
|
684 |
void purple_conversation_update(PurpleConversation *conv, PurpleConvUpdateType type); |
|
Evan@653
|
685 |
|
|
Evan@653
|
686 |
/** |
|
Evan@653
|
687 |
* Calls a function on each conversation. |
|
Evan@653
|
688 |
* |
|
Evan@653
|
689 |
* @param func The function. |
|
Evan@653
|
690 |
*/ |
|
Evan@653
|
691 |
void purple_conversation_foreach(void (*func)(PurpleConversation *conv)); |
|
Evan@653
|
692 |
|
|
Evan@653
|
693 |
/** |
|
Evan@653
|
694 |
* Retrieve the message history of a conversation. |
|
Evan@653
|
695 |
* |
|
Evan@653
|
696 |
* @param conv The conversation |
|
Evan@653
|
697 |
* |
|
Evan@653
|
698 |
* @return A GList of PurpleConvMessage's. The must not modify the list or the data within. |
|
Evan@653
|
699 |
* The list contains the newest message at the beginning, and the oldest message at |
|
Evan@653
|
700 |
* the end. |
|
Evan@653
|
701 |
* |
|
Evan@653
|
702 |
* @since 2.2.0 |
|
Evan@653
|
703 |
*/ |
|
Evan@653
|
704 |
GList *purple_conversation_get_message_history(PurpleConversation *conv); |
|
Evan@653
|
705 |
|
|
Evan@653
|
706 |
/** |
|
Evan@653
|
707 |
* Clear the message history of a conversation. |
|
Evan@653
|
708 |
* |
|
Evan@653
|
709 |
* @param conv The conversation |
|
Evan@653
|
710 |
* |
|
Evan@653
|
711 |
* @since 2.2.0 |
|
Evan@653
|
712 |
*/ |
|
Evan@653
|
713 |
void purple_conversation_clear_message_history(PurpleConversation *conv); |
|
Evan@653
|
714 |
|
|
Evan@653
|
715 |
/** |
|
Evan@653
|
716 |
* Get the sender from a PurpleConvMessage |
|
Evan@653
|
717 |
* |
|
Evan@653
|
718 |
* @param msg A PurpleConvMessage |
|
Evan@653
|
719 |
* |
|
Evan@653
|
720 |
* @return The name of the sender of the message |
|
Evan@653
|
721 |
* |
|
Evan@653
|
722 |
* @since 2.2.0 |
|
Evan@653
|
723 |
*/ |
|
Evan@653
|
724 |
const char *purple_conversation_message_get_sender(PurpleConvMessage *msg); |
|
Evan@653
|
725 |
|
|
Evan@653
|
726 |
/** |
|
Evan@653
|
727 |
* Get the message from a PurpleConvMessage |
|
Evan@653
|
728 |
* |
|
Evan@653
|
729 |
* @param msg A PurpleConvMessage |
|
Evan@653
|
730 |
* |
|
Evan@653
|
731 |
* @return The name of the sender of the message |
|
Evan@653
|
732 |
* |
|
Evan@653
|
733 |
* @since 2.2.0 |
|
Evan@653
|
734 |
*/ |
|
Evan@653
|
735 |
const char *purple_conversation_message_get_message(PurpleConvMessage *msg); |
|
Evan@653
|
736 |
|
|
Evan@653
|
737 |
/** |
|
Evan@653
|
738 |
* Get the message-flags of a PurpleConvMessage |
|
Evan@653
|
739 |
* |
|
Evan@653
|
740 |
* @param msg A PurpleConvMessage |
|
Evan@653
|
741 |
* |
|
Evan@653
|
742 |
* @return The message flags |
|
Evan@653
|
743 |
* |
|
Evan@653
|
744 |
* @since 2.2.0 |
|
Evan@653
|
745 |
*/ |
|
Evan@653
|
746 |
PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg); |
|
Evan@653
|
747 |
|
|
Evan@653
|
748 |
/** |
|
Evan@653
|
749 |
* Get the timestamp of a PurpleConvMessage |
|
Evan@653
|
750 |
* |
|
Evan@653
|
751 |
* @param msg A PurpleConvMessage |
|
Evan@653
|
752 |
* |
|
Evan@653
|
753 |
* @return The timestamp of the message |
|
Evan@653
|
754 |
* |
|
Evan@653
|
755 |
* @since 2.2.0 |
|
Evan@653
|
756 |
*/ |
|
Evan@653
|
757 |
time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg); |
|
Evan@653
|
758 |
|
|
Evan@653
|
759 |
/*@}*/ |
|
Evan@653
|
760 |
|
|
Evan@653
|
761 |
|
|
Evan@653
|
762 |
/**************************************************************************/ |
|
Evan@653
|
763 |
/** @name IM Conversation API */ |
|
Evan@653
|
764 |
/**************************************************************************/ |
|
Evan@653
|
765 |
/*@{*/ |
|
Evan@653
|
766 |
|
|
Evan@653
|
767 |
/** |
|
Evan@653
|
768 |
* Gets an IM's parent conversation. |
|
Evan@653
|
769 |
* |
|
Evan@653
|
770 |
* @param im The IM. |
|
Evan@653
|
771 |
* |
|
Evan@653
|
772 |
* @return The parent conversation. |
|
Evan@653
|
773 |
*/ |
|
Evan@653
|
774 |
PurpleConversation *purple_conv_im_get_conversation(const PurpleConvIm *im); |
|
Evan@653
|
775 |
|
|
Evan@653
|
776 |
/** |
|
Evan@653
|
777 |
* Sets the IM's buddy icon. |
|
Evan@653
|
778 |
* |
|
Evan@653
|
779 |
* This should only be called from within Purple. You probably want to |
|
Evan@653
|
780 |
* call purple_buddy_icon_set_data(). |
|
Evan@653
|
781 |
* |
|
Evan@653
|
782 |
* @param im The IM. |
|
Evan@653
|
783 |
* @param icon The buddy icon. |
|
Evan@653
|
784 |
* |
|
Evan@653
|
785 |
* @see purple_buddy_icon_set_data() |
|
Evan@653
|
786 |
*/ |
|
Evan@653
|
787 |
void purple_conv_im_set_icon(PurpleConvIm *im, PurpleBuddyIcon *icon); |
|
Evan@653
|
788 |
|
|
Evan@653
|
789 |
/** |
|
Evan@653
|
790 |
* Returns the IM's buddy icon. |
|
Evan@653
|
791 |
* |
|
Evan@653
|
792 |
* @param im The IM. |
|
Evan@653
|
793 |
* |
|
Evan@653
|
794 |
* @return The buddy icon. |
|
Evan@653
|
795 |
*/ |
|
Evan@653
|
796 |
PurpleBuddyIcon *purple_conv_im_get_icon(const PurpleConvIm *im); |
|
Evan@653
|
797 |
|
|
Evan@653
|
798 |
/** |
|
Evan@653
|
799 |
* Sets the IM's typing state. |
|
Evan@653
|
800 |
* |
|
Evan@653
|
801 |
* @param im The IM. |
|
Evan@653
|
802 |
* @param state The typing state. |
|
Evan@653
|
803 |
*/ |
|
Evan@653
|
804 |
void purple_conv_im_set_typing_state(PurpleConvIm *im, PurpleTypingState state); |
|
Evan@653
|
805 |
|
|
Evan@653
|
806 |
/** |
|
Evan@653
|
807 |
* Returns the IM's typing state. |
|
Evan@653
|
808 |
* |
|
Evan@653
|
809 |
* @param im The IM. |
|
Evan@653
|
810 |
* |
|
Evan@653
|
811 |
* @return The IM's typing state. |
|
Evan@653
|
812 |
*/ |
|
Evan@653
|
813 |
PurpleTypingState purple_conv_im_get_typing_state(const PurpleConvIm *im); |
|
Evan@653
|
814 |
|
|
Evan@653
|
815 |
/** |
|
Evan@653
|
816 |
* Starts the IM's typing timeout. |
|
Evan@653
|
817 |
* |
|
Evan@653
|
818 |
* @param im The IM. |
|
Evan@653
|
819 |
* @param timeout The timeout. |
|
Evan@653
|
820 |
*/ |
|
Evan@653
|
821 |
void purple_conv_im_start_typing_timeout(PurpleConvIm *im, int timeout); |
|
Evan@653
|
822 |
|
|
Evan@653
|
823 |
/** |
|
Evan@653
|
824 |
* Stops the IM's typing timeout. |
|
Evan@653
|
825 |
* |
|
Evan@653
|
826 |
* @param im The IM. |
|
Evan@653
|
827 |
*/ |
|
Evan@653
|
828 |
void purple_conv_im_stop_typing_timeout(PurpleConvIm *im); |
|
Evan@653
|
829 |
|
|
Evan@653
|
830 |
/** |
|
Evan@653
|
831 |
* Returns the IM's typing timeout. |
|
Evan@653
|
832 |
* |
|
Evan@653
|
833 |
* @param im The IM. |
|
Evan@653
|
834 |
* |
|
Evan@653
|
835 |
* @return The timeout. |
|
Evan@653
|
836 |
*/ |
|
Evan@653
|
837 |
guint purple_conv_im_get_typing_timeout(const PurpleConvIm *im); |
|
Evan@653
|
838 |
|
|
Evan@653
|
839 |
/** |
|
Evan@653
|
840 |
* Sets the quiet-time when no PURPLE_TYPING messages will be sent. |
|
Evan@653
|
841 |
* Few protocols need this (maybe only MSN). If the user is still |
|
Evan@653
|
842 |
* typing after this quiet-period, then another PURPLE_TYPING message |
|
Evan@653
|
843 |
* will be sent. |
|
Evan@653
|
844 |
* |
|
Evan@653
|
845 |
* @param im The IM. |
|
Evan@653
|
846 |
* @param val The number of seconds to wait before allowing another |
|
Evan@653
|
847 |
* PURPLE_TYPING message to be sent to the user. Or 0 to |
|
Evan@653
|
848 |
* not send another PURPLE_TYPING message. |
|
Evan@653
|
849 |
*/ |
|
Evan@653
|
850 |
void purple_conv_im_set_type_again(PurpleConvIm *im, unsigned int val); |
|
Evan@653
|
851 |
|
|
Evan@653
|
852 |
/** |
|
Evan@653
|
853 |
* Returns the time after which another PURPLE_TYPING message should be sent. |
|
Evan@653
|
854 |
* |
|
Evan@653
|
855 |
* @param im The IM. |
|
Evan@653
|
856 |
* |
|
Evan@653
|
857 |
* @return The time in seconds since the epoch. Or 0 if no additional |
|
Evan@653
|
858 |
* PURPLE_TYPING message should be sent. |
|
Evan@653
|
859 |
*/ |
|
Evan@653
|
860 |
time_t purple_conv_im_get_type_again(const PurpleConvIm *im); |
|
Evan@653
|
861 |
|
|
Evan@653
|
862 |
/** |
|
Evan@653
|
863 |
* Starts the IM's type again timeout. |
|
Evan@653
|
864 |
* |
|
Evan@653
|
865 |
* @param im The IM. |
|
Evan@653
|
866 |
*/ |
|
Evan@653
|
867 |
void purple_conv_im_start_send_typed_timeout(PurpleConvIm *im); |
|
Evan@653
|
868 |
|
|
Evan@653
|
869 |
/** |
|
Evan@653
|
870 |
* Stops the IM's type again timeout. |
|
Evan@653
|
871 |
* |
|
Evan@653
|
872 |
* @param im The IM. |
|
Evan@653
|
873 |
*/ |
|
Evan@653
|
874 |
void purple_conv_im_stop_send_typed_timeout(PurpleConvIm *im); |
|
Evan@653
|
875 |
|
|
Evan@653
|
876 |
/** |
|
Evan@653
|
877 |
* Returns the IM's type again timeout interval. |
|
Evan@653
|
878 |
* |
|
Evan@653
|
879 |
* @param im The IM. |
|
Evan@653
|
880 |
* |
|
Evan@653
|
881 |
* @return The type again timeout interval. |
|
Evan@653
|
882 |
*/ |
|
Evan@653
|
883 |
guint purple_conv_im_get_send_typed_timeout(const PurpleConvIm *im); |
|
Evan@653
|
884 |
|
|
Evan@653
|
885 |
/** |
|
Evan@653
|
886 |
* Updates the visual typing notification for an IM conversation. |
|
Evan@653
|
887 |
* |
|
Evan@653
|
888 |
* @param im The IM. |
|
Evan@653
|
889 |
*/ |
|
Evan@653
|
890 |
void purple_conv_im_update_typing(PurpleConvIm *im); |
|
Evan@653
|
891 |
|
|
Evan@653
|
892 |
/** |
|
Evan@653
|
893 |
* Writes to an IM. |
|
Evan@653
|
894 |
* |
|
Evan@653
|
895 |
* @param im The IM. |
|
Evan@653
|
896 |
* @param who The user who sent the message. |
|
Evan@653
|
897 |
* @param message The message to write. |
|
Evan@653
|
898 |
* @param flags The message flags. |
|
Evan@653
|
899 |
* @param mtime The time the message was sent. |
|
Evan@653
|
900 |
*/ |
|
Evan@653
|
901 |
void purple_conv_im_write(PurpleConvIm *im, const char *who, |
|
Evan@653
|
902 |
const char *message, PurpleMessageFlags flags, |
|
Evan@653
|
903 |
time_t mtime); |
|
Evan@653
|
904 |
|
|
Evan@653
|
905 |
/** |
|
Evan@653
|
906 |
* Presents an IM-error to the user |
|
Evan@653
|
907 |
* |
|
Evan@653
|
908 |
* This is a helper function to find a conversation, write an error to it, and |
|
Evan@653
|
909 |
* raise the window. If a conversation with this user doesn't already exist, |
|
Evan@653
|
910 |
* the function will return FALSE and the calling function can attempt to present |
|
Evan@653
|
911 |
* the error another way (purple_notify_error, most likely) |
|
Evan@653
|
912 |
* |
|
Evan@653
|
913 |
* @param who The user this error is about |
|
Evan@653
|
914 |
* @param account The account this error is on |
|
Evan@653
|
915 |
* @param what The error |
|
Evan@653
|
916 |
* @return TRUE if the error was presented, else FALSE |
|
Evan@653
|
917 |
*/ |
|
Evan@653
|
918 |
gboolean purple_conv_present_error(const char *who, PurpleAccount *account, const char *what); |
|
Evan@653
|
919 |
|
|
Evan@653
|
920 |
/** |
|
Evan@653
|
921 |
* Sends a message to this IM conversation. |
|
Evan@653
|
922 |
* |
|
Evan@653
|
923 |
* @param im The IM. |
|
Evan@653
|
924 |
* @param message The message to send. |
|
Evan@653
|
925 |
*/ |
|
Evan@653
|
926 |
void purple_conv_im_send(PurpleConvIm *im, const char *message); |
|
Evan@653
|
927 |
|
|
Evan@653
|
928 |
/** |
|
Evan@653
|
929 |
* Sends a message to a conversation after confirming with |
|
Evan@653
|
930 |
* the user. |
|
Evan@653
|
931 |
* |
|
Evan@653
|
932 |
* This function is intended for use in cases where the user |
|
Evan@653
|
933 |
* hasn't explicitly and knowingly caused a message to be sent. |
|
Evan@653
|
934 |
* The confirmation ensures that the user isn't sending a |
|
Evan@653
|
935 |
* message by mistake. |
|
Evan@653
|
936 |
* |
|
Evan@653
|
937 |
* @param conv The conversation. |
|
Evan@653
|
938 |
* @param message The message to send. |
|
Evan@653
|
939 |
*/ |
|
Evan@653
|
940 |
void purple_conv_send_confirm(PurpleConversation *conv, const char *message); |
|
Evan@653
|
941 |
|
|
Evan@653
|
942 |
/** |
|
Evan@653
|
943 |
* Sends a message to this IM conversation with specified flags. |
|
Evan@653
|
944 |
* |
|
Evan@653
|
945 |
* @param im The IM. |
|
Evan@653
|
946 |
* @param message The message to send. |
|
Evan@653
|
947 |
* @param flags The PurpleMessageFlags flags to use in addition to PURPLE_MESSAGE_SEND. |
|
Evan@653
|
948 |
*/ |
|
Evan@653
|
949 |
void purple_conv_im_send_with_flags(PurpleConvIm *im, const char *message, PurpleMessageFlags flags); |
|
Evan@653
|
950 |
|
|
Evan@653
|
951 |
/** |
|
Evan@653
|
952 |
* Adds a smiley to the conversation's smiley tree. If this returns |
|
Evan@653
|
953 |
* @c TRUE you should call purple_conv_custom_smiley_write() one or more |
|
Evan@653
|
954 |
* times, and then purple_conv_custom_smiley_close(). If this returns |
|
Evan@653
|
955 |
* @c FALSE, either the conv or smile were invalid, or the icon was |
|
Evan@653
|
956 |
* found in the cache. In either case, calling write or close would |
|
Evan@653
|
957 |
* be an error. |
|
Evan@653
|
958 |
* |
|
Evan@653
|
959 |
* @param conv The conversation to associate the smiley with. |
|
Evan@653
|
960 |
* @param smile The text associated with the smiley |
|
Evan@653
|
961 |
* @param cksum_type The type of checksum. |
|
Evan@653
|
962 |
* @param chksum The checksum, as a NUL terminated base64 string. |
|
Evan@653
|
963 |
* @param remote @c TRUE if the custom smiley is set by the remote user (buddy). |
|
Evan@653
|
964 |
* @return @c TRUE if an icon is expected, else FALSE. Note that |
|
Evan@653
|
965 |
* it is an error to never call purple_conv_custom_smiley_close if |
|
Evan@653
|
966 |
* this function returns @c TRUE, but an error to call it if |
|
Evan@653
|
967 |
* @c FALSE is returned. |
|
Evan@653
|
968 |
*/ |
|
Evan@653
|
969 |
|
|
Evan@653
|
970 |
gboolean purple_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, |
|
Evan@653
|
971 |
const char *cksum_type, const char *chksum, |
|
Evan@653
|
972 |
gboolean remote); |
|
Evan@653
|
973 |
|
|
Evan@653
|
974 |
|
|
Evan@653
|
975 |
/** |
|
Evan@653
|
976 |
* Updates the image associated with the current smiley. |
|
Evan@653
|
977 |
* |
|
Evan@653
|
978 |
* @param conv The conversation associated with the smiley. |
|
Evan@653
|
979 |
* @param smile The text associated with the smiley. |
|
Evan@653
|
980 |
* @param data The actual image data. |
|
Evan@653
|
981 |
* @param size The length of the data. |
|
Evan@653
|
982 |
*/ |
|
Evan@653
|
983 |
|
|
Evan@653
|
984 |
void purple_conv_custom_smiley_write(PurpleConversation *conv, |
|
Evan@653
|
985 |
const char *smile, |
|
Evan@653
|
986 |
const guchar *data, |
|
Evan@653
|
987 |
gsize size); |
|
Evan@653
|
988 |
|
|
Evan@653
|
989 |
/** |
|
Evan@653
|
990 |
* Close the custom smiley, all data has been written with |
|
Evan@653
|
991 |
* purple_conv_custom_smiley_write, and it is no longer valid |
|
Evan@653
|
992 |
* to call that function on that smiley. |
|
Evan@653
|
993 |
* |
|
Evan@653
|
994 |
* @param conv The purple conversation associated with the smiley. |
|
Evan@653
|
995 |
* @param smile The text associated with the smiley |
|
Evan@653
|
996 |
*/ |
|
Evan@653
|
997 |
|
|
Evan@653
|
998 |
void purple_conv_custom_smiley_close(PurpleConversation *conv, const char *smile); |
|
Evan@653
|
999 |
|
|
Evan@653
|
1000 |
/*@}*/ |
|
Evan@653
|
1001 |
|
|
Evan@653
|
1002 |
|
|
Evan@653
|
1003 |
/**************************************************************************/ |
|
Evan@653
|
1004 |
/** @name Chat Conversation API */ |
|
Evan@653
|
1005 |
/**************************************************************************/ |
|
Evan@653
|
1006 |
/*@{*/ |
|
Evan@653
|
1007 |
|
|
Evan@653
|
1008 |
/** |
|
Evan@653
|
1009 |
* Gets a chat's parent conversation. |
|
Evan@653
|
1010 |
* |
|
Evan@653
|
1011 |
* @param chat The chat. |
|
Evan@653
|
1012 |
* |
|
Evan@653
|
1013 |
* @return The parent conversation. |
|
Evan@653
|
1014 |
*/ |
|
Evan@653
|
1015 |
PurpleConversation *purple_conv_chat_get_conversation(const PurpleConvChat *chat); |
|
Evan@653
|
1016 |
|
|
Evan@653
|
1017 |
/** |
|
Evan@653
|
1018 |
* Sets the list of users in the chat room. |
|
Evan@653
|
1019 |
* |
|
Evan@653
|
1020 |
* @note Calling this function will not update the display of the users. |
|
Evan@653
|
1021 |
* Please use purple_conv_chat_add_user(), purple_conv_chat_add_users(), |
|
Evan@653
|
1022 |
* purple_conv_chat_remove_user(), and purple_conv_chat_remove_users() instead. |
|
Evan@653
|
1023 |
* |
|
Evan@653
|
1024 |
* @param chat The chat. |
|
Evan@653
|
1025 |
* @param users The list of users. |
|
Evan@653
|
1026 |
* |
|
Evan@653
|
1027 |
* @return The list passed. |
|
Evan@653
|
1028 |
*/ |
|
Evan@653
|
1029 |
GList *purple_conv_chat_set_users(PurpleConvChat *chat, GList *users); |
|
Evan@653
|
1030 |
|
|
Evan@653
|
1031 |
/** |
|
Evan@653
|
1032 |
* Returns a list of users in the chat room. |
|
Evan@653
|
1033 |
* |
|
Evan@653
|
1034 |
* @param chat The chat. |
|
Evan@653
|
1035 |
* |
|
Evan@653
|
1036 |
* @constreturn The list of users. |
|
Evan@653
|
1037 |
*/ |
|
Evan@653
|
1038 |
GList *purple_conv_chat_get_users(const PurpleConvChat *chat); |
|
Evan@653
|
1039 |
|
|
Evan@653
|
1040 |
/** |
|
Evan@653
|
1041 |
* Ignores a user in a chat room. |
|
Evan@653
|
1042 |
* |
|
Evan@653
|
1043 |
* @param chat The chat. |
|
Evan@653
|
1044 |
* @param name The name of the user. |
|
Evan@653
|
1045 |
*/ |
|
Evan@653
|
1046 |
void purple_conv_chat_ignore(PurpleConvChat *chat, const char *name); |
|
Evan@653
|
1047 |
|
|
Evan@653
|
1048 |
/** |
|
Evan@653
|
1049 |
* Unignores a user in a chat room. |
|
Evan@653
|
1050 |
* |
|
Evan@653
|
1051 |
* @param chat The chat. |
|
Evan@653
|
1052 |
* @param name The name of the user. |
|
Evan@653
|
1053 |
*/ |
|
Evan@653
|
1054 |
void purple_conv_chat_unignore(PurpleConvChat *chat, const char *name); |
|
Evan@653
|
1055 |
|
|
Evan@653
|
1056 |
/** |
|
Evan@653
|
1057 |
* Sets the list of ignored users in the chat room. |
|
Evan@653
|
1058 |
* |
|
Evan@653
|
1059 |
* @param chat The chat. |
|
Evan@653
|
1060 |
* @param ignored The list of ignored users. |
|
Evan@653
|
1061 |
* |
|
Evan@653
|
1062 |
* @return The list passed. |
|
Evan@653
|
1063 |
*/ |
|
Evan@653
|
1064 |
GList *purple_conv_chat_set_ignored(PurpleConvChat *chat, GList *ignored); |
|
Evan@653
|
1065 |
|
|
Evan@653
|
1066 |
/** |
|
Evan@653
|
1067 |
* Returns the list of ignored users in the chat room. |
|
Evan@653
|
1068 |
* |
|
Evan@653
|
1069 |
* @param chat The chat. |
|
Evan@653
|
1070 |
* |
|
Evan@653
|
1071 |
* @constreturn The list of ignored users. |
|
Evan@653
|
1072 |
*/ |
|
Evan@653
|
1073 |
GList *purple_conv_chat_get_ignored(const PurpleConvChat *chat); |
|
Evan@653
|
1074 |
|
|
Evan@653
|
1075 |
/** |
|
Evan@653
|
1076 |
* Returns the actual name of the specified ignored user, if it exists in |
|
Evan@653
|
1077 |
* the ignore list. |
|
Evan@653
|
1078 |
* |
|
Evan@653
|
1079 |
* If the user found contains a prefix, such as '+' or '\@', this is also |
|
Evan@653
|
1080 |
* returned. The username passed to the function does not have to have this |
|
Evan@653
|
1081 |
* formatting. |
|
Evan@653
|
1082 |
* |
|
Evan@653
|
1083 |
* @param chat The chat. |
|
Evan@653
|
1084 |
* @param user The user to check in the ignore list. |
|
Evan@653
|
1085 |
* |
|
Evan@653
|
1086 |
* @return The ignored user if found, complete with prefixes, or @c NULL |
|
Evan@653
|
1087 |
* if not found. |
|
Evan@653
|
1088 |
*/ |
|
Evan@653
|
1089 |
const char *purple_conv_chat_get_ignored_user(const PurpleConvChat *chat, |
|
Evan@653
|
1090 |
const char *user); |
|
Evan@653
|
1091 |
|
|
Evan@653
|
1092 |
/** |
|
Evan@653
|
1093 |
* Returns @c TRUE if the specified user is ignored. |
|
Evan@653
|
1094 |
* |
|
Evan@653
|
1095 |
* @param chat The chat. |
|
Evan@653
|
1096 |
* @param user The user. |
|
Evan@653
|
1097 |
* |
|
Evan@653
|
1098 |
* @return @c TRUE if the user is in the ignore list; @c FALSE otherwise. |
|
Evan@653
|
1099 |
*/ |
|
Evan@653
|
1100 |
gboolean purple_conv_chat_is_user_ignored(const PurpleConvChat *chat, |
|
Evan@653
|
1101 |
const char *user); |
|
Evan@653
|
1102 |
|
|
Evan@653
|
1103 |
/** |
|
Evan@653
|
1104 |
* Sets the chat room's topic. |
|
Evan@653
|
1105 |
* |
|
Evan@653
|
1106 |
* @param chat The chat. |
|
Evan@653
|
1107 |
* @param who The user that set the topic. |
|
Evan@653
|
1108 |
* @param topic The topic. |
|
Evan@653
|
1109 |
*/ |
|
Evan@653
|
1110 |
void purple_conv_chat_set_topic(PurpleConvChat *chat, const char *who, |
|
Evan@653
|
1111 |
const char *topic); |
|
Evan@653
|
1112 |
|
|
Evan@653
|
1113 |
/** |
|
Evan@653
|
1114 |
* Returns the chat room's topic. |
|
Evan@653
|
1115 |
* |
|
Evan@653
|
1116 |
* @param chat The chat. |
|
Evan@653
|
1117 |
* |
|
Evan@653
|
1118 |
* @return The chat's topic. |
|
Evan@653
|
1119 |
*/ |
|
Evan@653
|
1120 |
const char *purple_conv_chat_get_topic(const PurpleConvChat *chat); |
|
Evan@653
|
1121 |
|
|
Evan@653
|
1122 |
/** |
|
Evan@653
|
1123 |
* Sets the chat room's ID. |
|
Evan@653
|
1124 |
* |
|
Evan@653
|
1125 |
* @param chat The chat. |
|
Evan@653
|
1126 |
* @param id The ID. |
|
Evan@653
|
1127 |
*/ |
|
Evan@653
|
1128 |
void purple_conv_chat_set_id(PurpleConvChat *chat, int id); |
|
Evan@653
|
1129 |
|
|
Evan@653
|
1130 |
/** |
|
Evan@653
|
1131 |
* Returns the chat room's ID. |
|
Evan@653
|
1132 |
* |
|
Evan@653
|
1133 |
* @param chat The chat. |
|
Evan@653
|
1134 |
* |
|
Evan@653
|
1135 |
* @return The ID. |
|
Evan@653
|
1136 |
*/ |
|
Evan@653
|
1137 |
int purple_conv_chat_get_id(const PurpleConvChat *chat); |
|
Evan@653
|
1138 |
|
|
Evan@653
|
1139 |
/** |
|
Evan@653
|
1140 |
* Writes to a chat. |
|
Evan@653
|
1141 |
* |
|
Evan@653
|
1142 |
* @param chat The chat. |
|
Evan@653
|
1143 |
* @param who The user who sent the message. |
|
Evan@653
|
1144 |
* @param message The message to write. |
|
Evan@653
|
1145 |
* @param flags The flags. |
|
Evan@653
|
1146 |
* @param mtime The time the message was sent. |
|
Evan@653
|
1147 |
*/ |
|
Evan@653
|
1148 |
void purple_conv_chat_write(PurpleConvChat *chat, const char *who, |
|
Evan@653
|
1149 |
const char *message, PurpleMessageFlags flags, |
|
Evan@653
|
1150 |
time_t mtime); |
|
Evan@653
|
1151 |
|
|
Evan@653
|
1152 |
/** |
|
Evan@653
|
1153 |
* Sends a message to this chat conversation. |
|
Evan@653
|
1154 |
* |
|
Evan@653
|
1155 |
* @param chat The chat. |
|
Evan@653
|
1156 |
* @param message The message to send. |
|
Evan@653
|
1157 |
*/ |
|
Evan@653
|
1158 |
void purple_conv_chat_send(PurpleConvChat *chat, const char *message); |
|
Evan@653
|
1159 |
|
|
Evan@653
|
1160 |
/** |
|
Evan@653
|
1161 |
* Sends a message to this chat conversation with specified flags. |
|
Evan@653
|
1162 |
* |
|
Evan@653
|
1163 |
* @param chat The chat. |
|
Evan@653
|
1164 |
* @param message The message to send. |
|
Evan@653
|
1165 |
* @param flags The PurpleMessageFlags flags to use. |
|
Evan@653
|
1166 |
*/ |
|
Evan@653
|
1167 |
void purple_conv_chat_send_with_flags(PurpleConvChat *chat, const char *message, PurpleMessageFlags flags); |
|
Evan@653
|
1168 |
|
|
Evan@653
|
1169 |
/** |
|
Evan@653
|
1170 |
* Adds a user to a chat. |
|
Evan@653
|
1171 |
* |
|
Evan@653
|
1172 |
* @param chat The chat. |
|
Evan@653
|
1173 |
* @param user The user to add. |
|
Evan@653
|
1174 |
* @param extra_msg An extra message to display with the join message. |
|
Evan@653
|
1175 |
* @param flags The users flags |
|
Evan@653
|
1176 |
* @param new_arrival Decides whether or not to show a join notice. |
|
Evan@653
|
1177 |
*/ |
|
Evan@653
|
1178 |
void purple_conv_chat_add_user(PurpleConvChat *chat, const char *user, |
|
Evan@653
|
1179 |
const char *extra_msg, PurpleConvChatBuddyFlags flags, |
|
Evan@653
|
1180 |
gboolean new_arrival); |
|
Evan@653
|
1181 |
|
|
Evan@653
|
1182 |
/** |
|
Evan@653
|
1183 |
* Adds a list of users to a chat. |
|
Evan@653
|
1184 |
* |
|
Evan@653
|
1185 |
* The data is copied from @a users, @a extra_msgs, and @a flags, so it is up to |
|
Evan@653
|
1186 |
* the caller to free this list after calling this function. |
|
Evan@653
|
1187 |
* |
|
Evan@653
|
1188 |
* @param chat The chat. |
|
Evan@653
|
1189 |
* @param users The list of users to add. |
|
Evan@653
|
1190 |
* @param extra_msgs An extra message to display with the join message for each |
|
Evan@653
|
1191 |
* user. This list may be shorter than @a users, in which |
|
Evan@653
|
1192 |
* case, the users after the end of extra_msgs will not have |
|
Evan@653
|
1193 |
* an extra message. By extension, this means that extra_msgs |
|
Evan@653
|
1194 |
* can simply be @c NULL and none of the users will have an |
|
Evan@653
|
1195 |
* extra message. |
|
Evan@653
|
1196 |
* @param flags The list of flags for each user. |
|
Evan@653
|
1197 |
* @param new_arrivals Decides whether or not to show join notices. |
|
Evan@653
|
1198 |
*/ |
|
Evan@653
|
1199 |
void purple_conv_chat_add_users(PurpleConvChat *chat, GList *users, GList *extra_msgs, |
|
Evan@653
|
1200 |
GList *flags, gboolean new_arrivals); |
|
Evan@653
|
1201 |
|
|
Evan@653
|
1202 |
/** |
|
Evan@653
|
1203 |
* Renames a user in a chat. |
|
Evan@653
|
1204 |
* |
|
Evan@653
|
1205 |
* @param chat The chat. |
|
Evan@653
|
1206 |
* @param old_user The old username. |
|
Evan@653
|
1207 |
* @param new_user The new username. |
|
Evan@653
|
1208 |
*/ |
|
Evan@653
|
1209 |
void purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user, |
|
Evan@653
|
1210 |
const char *new_user); |
|
Evan@653
|
1211 |
|
|
Evan@653
|
1212 |
/** |
|
Evan@653
|
1213 |
* Removes a user from a chat, optionally with a reason. |
|
Evan@653
|
1214 |
* |
|
Evan@653
|
1215 |
* It is up to the developer to free this list after calling this function. |
|
Evan@653
|
1216 |
* |
|
Evan@653
|
1217 |
* @param chat The chat. |
|
Evan@653
|
1218 |
* @param user The user that is being removed. |
|
Evan@653
|
1219 |
* @param reason The optional reason given for the removal. Can be @c NULL. |
|
Evan@653
|
1220 |
*/ |
|
Evan@653
|
1221 |
void purple_conv_chat_remove_user(PurpleConvChat *chat, const char *user, |
|
Evan@653
|
1222 |
const char *reason); |
|
Evan@653
|
1223 |
|
|
Evan@653
|
1224 |
/** |
|
Evan@653
|
1225 |
* Removes a list of users from a chat, optionally with a single reason. |
|
Evan@653
|
1226 |
* |
|
Evan@653
|
1227 |
* @param chat The chat. |
|
Evan@653
|
1228 |
* @param users The users that are being removed. |
|
Evan@653
|
1229 |
* @param reason The optional reason given for the removal. Can be @c NULL. |
|
Evan@653
|
1230 |
*/ |
|
Evan@653
|
1231 |
void purple_conv_chat_remove_users(PurpleConvChat *chat, GList *users, |
|
Evan@653
|
1232 |
const char *reason); |
|
Evan@653
|
1233 |
|
|
Evan@653
|
1234 |
/** |
|
Evan@653
|
1235 |
* Finds a user in a chat |
|
Evan@653
|
1236 |
* |
|
Evan@653
|
1237 |
* @param chat The chat. |
|
Evan@653
|
1238 |
* @param user The user to look for. |
|
Evan@653
|
1239 |
* |
|
Evan@653
|
1240 |
* @return TRUE if the user is in the chat, FALSE if not |
|
Evan@653
|
1241 |
*/ |
|
Evan@653
|
1242 |
gboolean purple_conv_chat_find_user(PurpleConvChat *chat, const char *user); |
|
Evan@653
|
1243 |
|
|
Evan@653
|
1244 |
/** |
|
Evan@653
|
1245 |
* Set a users flags in a chat |
|
Evan@653
|
1246 |
* |
|
Evan@653
|
1247 |
* @param chat The chat. |
|
Evan@653
|
1248 |
* @param user The user to update. |
|
Evan@653
|
1249 |
* @param flags The new flags. |
|
Evan@653
|
1250 |
*/ |
|
Evan@653
|
1251 |
void purple_conv_chat_user_set_flags(PurpleConvChat *chat, const char *user, |
|
Evan@653
|
1252 |
PurpleConvChatBuddyFlags flags); |
|
Evan@653
|
1253 |
|
|
Evan@653
|
1254 |
/** |
|
Evan@653
|
1255 |
* Get the flags for a user in a chat |
|
Evan@653
|
1256 |
* |
|
Evan@653
|
1257 |
* @param chat The chat. |
|
Evan@653
|
1258 |
* @param user The user to find the flags for |
|
Evan@653
|
1259 |
* |
|
Evan@653
|
1260 |
* @return The flags for the user |
|
Evan@653
|
1261 |
*/ |
|
Evan@653
|
1262 |
PurpleConvChatBuddyFlags purple_conv_chat_user_get_flags(PurpleConvChat *chat, |
|
Evan@653
|
1263 |
const char *user); |
|
Evan@653
|
1264 |
|
|
Evan@653
|
1265 |
/** |
|
Evan@653
|
1266 |
* Clears all users from a chat. |
|
Evan@653
|
1267 |
* |
|
Evan@653
|
1268 |
* @param chat The chat. |
|
Evan@653
|
1269 |
*/ |
|
Evan@653
|
1270 |
void purple_conv_chat_clear_users(PurpleConvChat *chat); |
|
Evan@653
|
1271 |
|
|
Evan@653
|
1272 |
/** |
|
Evan@653
|
1273 |
* Sets your nickname (used for hilighting) for a chat. |
|
Evan@653
|
1274 |
* |
|
Evan@653
|
1275 |
* @param chat The chat. |
|
Evan@653
|
1276 |
* @param nick The nick. |
|
Evan@653
|
1277 |
*/ |
|
Evan@653
|
1278 |
void purple_conv_chat_set_nick(PurpleConvChat *chat, const char *nick); |
|
Evan@653
|
1279 |
|
|
Evan@653
|
1280 |
/** |
|
Evan@653
|
1281 |
* Gets your nickname (used for hilighting) for a chat. |
|
Evan@653
|
1282 |
* |
|
Evan@653
|
1283 |
* @param chat The chat. |
|
Evan@653
|
1284 |
* @return The nick. |
|
Evan@653
|
1285 |
*/ |
|
Evan@653
|
1286 |
const char *purple_conv_chat_get_nick(PurpleConvChat *chat); |
|
Evan@653
|
1287 |
|
|
Evan@653
|
1288 |
/** |
|
Evan@653
|
1289 |
* Finds a chat with the specified chat ID. |
|
Evan@653
|
1290 |
* |
|
Evan@653
|
1291 |
* @param gc The purple_connection. |
|
Evan@653
|
1292 |
* @param id The chat ID. |
|
Evan@653
|
1293 |
* |
|
Evan@653
|
1294 |
* @return The chat conversation. |
|
Evan@653
|
1295 |
*/ |
|
Evan@653
|
1296 |
PurpleConversation *purple_find_chat(const PurpleConnection *gc, int id); |
|
Evan@653
|
1297 |
|
|
Evan@653
|
1298 |
/** |
|
Evan@653
|
1299 |
* Lets the core know we left a chat, without destroying it. |
|
Evan@653
|
1300 |
* Called from serv_got_chat_left(). |
|
Evan@653
|
1301 |
* |
|
Evan@653
|
1302 |
* @param chat The chat. |
|
Evan@653
|
1303 |
*/ |
|
Evan@653
|
1304 |
void purple_conv_chat_left(PurpleConvChat *chat); |
|
Evan@653
|
1305 |
|
|
Evan@653
|
1306 |
/** |
|
zacw@1759
|
1307 |
* Invite a user to a chat. |
|
zacw@1759
|
1308 |
* The user will be prompted to enter the user's name or a message if one is |
|
zacw@1759
|
1309 |
* not given. |
|
zacw@1759
|
1310 |
* |
|
zacw@1759
|
1311 |
* @param chat The chat. |
|
zacw@1759
|
1312 |
* @param user The user to invite to the chat. |
|
zacw@1759
|
1313 |
* @param message The message to send with the invitation. |
|
zacw@1759
|
1314 |
* @param confirm Prompt before sending the invitation. The user is always |
|
zacw@1759
|
1315 |
* prompted if either #user or #message is @c NULL. |
|
zacw@1759
|
1316 |
* |
|
zacw@1759
|
1317 |
* @since 2.6.0 |
|
zacw@1759
|
1318 |
*/ |
|
zacw@1759
|
1319 |
void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, |
|
zacw@1759
|
1320 |
const char *message, gboolean confirm); |
|
zacw@1759
|
1321 |
|
|
zacw@1759
|
1322 |
/** |
|
Evan@653
|
1323 |
* Returns true if we're no longer in this chat, |
|
Evan@653
|
1324 |
* and just left the window open. |
|
Evan@653
|
1325 |
* |
|
Evan@653
|
1326 |
* @param chat The chat. |
|
Evan@653
|
1327 |
* |
|
Evan@653
|
1328 |
* @return @c TRUE if we left the chat already, @c FALSE if |
|
Evan@653
|
1329 |
* we're still there. |
|
Evan@653
|
1330 |
*/ |
|
Evan@653
|
1331 |
gboolean purple_conv_chat_has_left(PurpleConvChat *chat); |
|
Evan@653
|
1332 |
|
|
Evan@653
|
1333 |
/** |
|
Evan@653
|
1334 |
* Creates a new chat buddy |
|
Evan@653
|
1335 |
* |
|
Evan@653
|
1336 |
* @param name The name. |
|
Evan@653
|
1337 |
* @param alias The alias. |
|
Evan@653
|
1338 |
* @param flags The flags. |
|
Evan@653
|
1339 |
* |
|
Evan@653
|
1340 |
* @return The new chat buddy |
|
Evan@653
|
1341 |
*/ |
|
Evan@653
|
1342 |
PurpleConvChatBuddy *purple_conv_chat_cb_new(const char *name, const char *alias, |
|
Evan@653
|
1343 |
PurpleConvChatBuddyFlags flags); |
|
Evan@653
|
1344 |
|
|
Evan@653
|
1345 |
/** |
|
Evan@653
|
1346 |
* Find a chat buddy in a chat |
|
Evan@653
|
1347 |
* |
|
Evan@653
|
1348 |
* @param chat The chat. |
|
Evan@653
|
1349 |
* @param name The name of the chat buddy to find. |
|
Evan@653
|
1350 |
*/ |
|
Evan@653
|
1351 |
PurpleConvChatBuddy *purple_conv_chat_cb_find(PurpleConvChat *chat, const char *name); |
|
Evan@653
|
1352 |
|
|
Evan@653
|
1353 |
/** |
|
Evan@653
|
1354 |
* Get the name of a chat buddy |
|
Evan@653
|
1355 |
* |
|
Evan@653
|
1356 |
* @param cb The chat buddy. |
|
Evan@653
|
1357 |
* |
|
Evan@653
|
1358 |
* @return The name of the chat buddy. |
|
Evan@653
|
1359 |
*/ |
|
Evan@653
|
1360 |
const char *purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb); |
|
Evan@653
|
1361 |
|
|
Evan@653
|
1362 |
/** |
|
zacw@1739
|
1363 |
* Get an attribute of a chat buddy |
|
zacw@1739
|
1364 |
* |
|
zacw@1739
|
1365 |
* @param cb The chat buddy. |
|
zacw@1739
|
1366 |
* @param key The key of the attribute. |
|
zacw@1739
|
1367 |
* |
|
zacw@1739
|
1368 |
* @return The value of the attribute key. |
|
zacw@1739
|
1369 |
*/ |
|
zacw@1739
|
1370 |
const char *purple_conv_chat_cb_get_attribute(PurpleConvChatBuddy *cb, const char *key); |
|
zacw@1739
|
1371 |
|
|
zacw@1739
|
1372 |
/** |
|
zacw@1739
|
1373 |
* Get the keys of all atributes of a chat buddy |
|
zacw@1739
|
1374 |
* |
|
zacw@1739
|
1375 |
* @param cb The chat buddy. |
|
zacw@1739
|
1376 |
* |
|
zacw@1739
|
1377 |
* @return A list of the attributes of a chat buddy. |
|
zacw@1739
|
1378 |
*/ |
|
zacw@1739
|
1379 |
GList *purple_conv_chat_cb_get_attribute_keys(PurpleConvChatBuddy *cb); |
|
zacw@1739
|
1380 |
|
|
zacw@1739
|
1381 |
/** |
|
zacw@1739
|
1382 |
* Set an attribute of a chat buddy |
|
zacw@1739
|
1383 |
* |
|
zacw@1739
|
1384 |
* @param chat The chat. |
|
zacw@1739
|
1385 |
* @param cb The chat buddy. |
|
zacw@1739
|
1386 |
* @param key The key of the attribute. |
|
zacw@1739
|
1387 |
* @param value The value of the attribute. |
|
zacw@1739
|
1388 |
*/ |
|
zacw@1739
|
1389 |
void purple_conv_chat_cb_set_attribute(PurpleConvChat *chat, PurpleConvChatBuddy *cb, const char *key, const char *value); |
|
zacw@1750
|
1390 |
|
|
zacw@1750
|
1391 |
/** |
|
zacw@1750
|
1392 |
* Set attributes of a chat buddy |
|
zacw@1750
|
1393 |
* |
|
zacw@1750
|
1394 |
* @param chat The chat. |
|
zacw@1750
|
1395 |
* @param cb The chat buddy. |
|
zacw@1750
|
1396 |
* @param keys A GList of the keys. |
|
zacw@1750
|
1397 |
* @param values A GList of the values. |
|
zacw@1750
|
1398 |
*/ |
|
zacw@1750
|
1399 |
void |
|
zacw@1750
|
1400 |
purple_conv_chat_cb_set_attributes(PurpleConvChat *chat, PurpleConvChatBuddy *cb, GList *keys, GList *values); |
|
zacw@1750
|
1401 |
|
|
zacw@1739
|
1402 |
|
|
zacw@1739
|
1403 |
/** |
|
Evan@653
|
1404 |
* Destroys a chat buddy |
|
Evan@653
|
1405 |
* |
|
Evan@653
|
1406 |
* @param cb The chat buddy to destroy |
|
Evan@653
|
1407 |
*/ |
|
Evan@653
|
1408 |
void purple_conv_chat_cb_destroy(PurpleConvChatBuddy *cb); |
|
Evan@653
|
1409 |
|
|
Evan@653
|
1410 |
/** |
|
Evan@653
|
1411 |
* Retrieves the extended menu items for the conversation. |
|
Evan@653
|
1412 |
* |
|
Evan@653
|
1413 |
* @param conv The conversation. |
|
Evan@1427
|
1414 |
* |
|
Evan@653
|
1415 |
* @return A list of PurpleMenuAction items, harvested by the |
|
Evan@653
|
1416 |
* chat-extended-menu signal. The list and the menuaction |
|
Evan@653
|
1417 |
* items should be freed by the caller. |
|
Evan@653
|
1418 |
* |
|
Evan@653
|
1419 |
* @since 2.1.0 |
|
Evan@653
|
1420 |
*/ |
|
Evan@653
|
1421 |
GList * purple_conversation_get_extended_menu(PurpleConversation *conv); |
|
Evan@653
|
1422 |
|
|
Evan@653
|
1423 |
/** |
|
Evan@653
|
1424 |
* Perform a command in a conversation. Similar to @see purple_cmd_do_command |
|
Evan@653
|
1425 |
* |
|
Evan@653
|
1426 |
* @param conv The conversation. |
|
Evan@653
|
1427 |
* @param cmdline The entire command including the arguments. |
|
Evan@653
|
1428 |
* @param markup @c NULL, or the formatted command line. |
|
Evan@653
|
1429 |
* @param error If the command failed errormsg is filled in with the appropriate error |
|
Evan@653
|
1430 |
* message, if not @c NULL. It must be freed by the caller with g_free(). |
|
Evan@653
|
1431 |
* |
|
Evan@653
|
1432 |
* @return @c TRUE if the command was executed successfully, @c FALSE otherwise. |
|
Evan@653
|
1433 |
* |
|
Evan@653
|
1434 |
* @since 2.1.0 |
|
Evan@653
|
1435 |
*/ |
|
Evan@653
|
1436 |
gboolean purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, const gchar *markup, gchar **error); |
|
Evan@653
|
1437 |
|
|
Evan@653
|
1438 |
/*@}*/ |
|
Evan@653
|
1439 |
|
|
Evan@653
|
1440 |
/**************************************************************************/ |
|
Evan@653
|
1441 |
/** @name Conversations Subsystem */ |
|
Evan@653
|
1442 |
/**************************************************************************/ |
|
Evan@653
|
1443 |
/*@{*/ |
|
Evan@653
|
1444 |
|
|
Evan@653
|
1445 |
/** |
|
Evan@653
|
1446 |
* Returns the conversation subsystem handle. |
|
Evan@653
|
1447 |
* |
|
Evan@653
|
1448 |
* @return The conversation subsystem handle. |
|
Evan@653
|
1449 |
*/ |
|
Evan@653
|
1450 |
void *purple_conversations_get_handle(void); |
|
Evan@653
|
1451 |
|
|
Evan@653
|
1452 |
/** |
|
Evan@653
|
1453 |
* Initializes the conversation subsystem. |
|
Evan@653
|
1454 |
*/ |
|
Evan@653
|
1455 |
void purple_conversations_init(void); |
|
Evan@653
|
1456 |
|
|
Evan@653
|
1457 |
/** |
|
Evan@653
|
1458 |
* Uninitializes the conversation subsystem. |
|
Evan@653
|
1459 |
*/ |
|
Evan@653
|
1460 |
void purple_conversations_uninit(void); |
|
Evan@653
|
1461 |
|
|
Evan@653
|
1462 |
/*@}*/ |
|
Evan@653
|
1463 |
|
|
Evan@653
|
1464 |
#ifdef __cplusplus |
|
Evan@653
|
1465 |
} |
|
Evan@653
|
1466 |
#endif |
|
Evan@653
|
1467 |
|
|
Evan@653
|
1468 |
#endif /* _PURPLE_CONVERSATION_H_ */ |