summaryrefslogtreecommitdiff
path: root/libpurple/conversation.h
blob: 9c60b540ff18a0feb082644540cb64df23858489 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
/* purple
 *
 * Purple is the legal property of its developers, whose names are too numerous
 * to list here.  Please refer to the COPYRIGHT file distributed with this
 * source distribution.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
 */

#ifndef PURPLE_CONVERSATION_H
#define PURPLE_CONVERSATION_H
/**
 * SECTION:conversation
 * @section_id: libpurple-conversation
 * @short_description: Conversation base class <filename>conversation.h</filename>
 * @title: Conversation Base Class
 *
 * This is the base class for the conversation abstraction on Libpurple.
 *
 * The present API manages the common functionallity for both kinds of conversations
 * @PurpleIMConversation and @PurpleChatConversation.
 */

#define PURPLE_TYPE_CONVERSATION             (purple_conversation_get_type())
#define PURPLE_CONVERSATION(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_CONVERSATION, PurpleConversation))
#define PURPLE_CONVERSATION_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_CONVERSATION, PurpleConversationClass))
#define PURPLE_IS_CONVERSATION(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_CONVERSATION))
#define PURPLE_IS_CONVERSATION_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_CONVERSATION))
#define PURPLE_CONVERSATION_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_CONVERSATION, PurpleConversationClass))

#define PURPLE_TYPE_CONVERSATION_UI_OPS      (purple_conversation_ui_ops_get_type())

#define PURPLE_TYPE_CONVERSATION_MESSAGE     (purple_conversation_message_get_type())

/**************************************************************************/
/* Data Structures                                                        */
/**************************************************************************/

typedef struct _PurpleConversation           PurpleConversation;
typedef struct _PurpleConversationClass      PurpleConversationClass;

typedef struct _PurpleConversationUiOps      PurpleConversationUiOps;

/**
 * PurpleConversationUpdateType:
 * @PURPLE_CONVERSATION_UPDATE_ADD:      The buddy associated with the
 *                                       conversation was added.
 * @PURPLE_CONVERSATION_UPDATE_REMOVE:   The buddy associated with the
 *                                       conversation was removed.
 * @PURPLE_CONVERSATION_UPDATE_ACCOUNT:  The purple_account was changed.
 * @PURPLE_CONVERSATION_UPDATE_TYPING:   The typing state was updated.
 * @PURPLE_CONVERSATION_UPDATE_UNSEEN:   The unseen state was updated.
 * @PURPLE_CONVERSATION_UPDATE_LOGGING:  Logging for this conversation was
 *                                       enabled or disabled.
 * @PURPLE_CONVERSATION_UPDATE_TOPIC:    The topic for a chat was updated.
 * @PURPLE_CONVERSATION_UPDATE_E2EE:     The End-to-end encryption state was
 *                                       updated.
 * @PURPLE_CONVERSATION_ACCOUNT_ONLINE:  One of the user's accounts went online.
 * @PURPLE_CONVERSATION_ACCOUNT_OFFLINE: One of the user's accounts went
 *                                       offline.
 * @PURPLE_CONVERSATION_UPDATE_AWAY:     The other user went away.
 * @PURPLE_CONVERSATION_UPDATE_ICON:     The other user's buddy icon changed.
 * @PURPLE_CONVERSATION_UPDATE_NAME:     The name of the conversation was changed.
 * @PURPLE_CONVERSATION_UPDATE_TITLE:    The title of the conversation was updated.
 * @PURPLE_CONVERSATION_UPDATE_CHATLEFT: The user left a chat.
 * @PURPLE_CONVERSATION_UPDATE_FEATURES: The features for a chat have changed.
 *
 * Conversation update type.
 */
typedef enum
{
	PURPLE_CONVERSATION_UPDATE_ADD = 0,
	PURPLE_CONVERSATION_UPDATE_REMOVE,
	PURPLE_CONVERSATION_UPDATE_ACCOUNT,
	PURPLE_CONVERSATION_UPDATE_TYPING,
	PURPLE_CONVERSATION_UPDATE_UNSEEN,
	PURPLE_CONVERSATION_UPDATE_LOGGING,
	PURPLE_CONVERSATION_UPDATE_TOPIC,
	PURPLE_CONVERSATION_UPDATE_E2EE,

	/*
	 * XXX These need to go when we implement a more generic core/UI event
	 * system.
	 */
	PURPLE_CONVERSATION_ACCOUNT_ONLINE,
	PURPLE_CONVERSATION_ACCOUNT_OFFLINE,
	PURPLE_CONVERSATION_UPDATE_AWAY,
	PURPLE_CONVERSATION_UPDATE_ICON,
	PURPLE_CONVERSATION_UPDATE_NAME,
	PURPLE_CONVERSATION_UPDATE_TITLE,
	PURPLE_CONVERSATION_UPDATE_CHATLEFT,

	PURPLE_CONVERSATION_UPDATE_FEATURES

} PurpleConversationUpdateType;

/**
 * PurpleMessageFlags:
 * @PURPLE_MESSAGE_SEND:        Outgoing message.
 * @PURPLE_MESSAGE_RECV:        Incoming message.
 * @PURPLE_MESSAGE_SYSTEM:      System message.
 * @PURPLE_MESSAGE_AUTO_RESP:   Auto response.
 * @PURPLE_MESSAGE_ACTIVE_ONLY: Hint to the UI that this message should not be
 *                              shown in conversations which are only open for
 *                              internal UI purposes (e.g. for contact-aware
 *                              conversations).
 * @PURPLE_MESSAGE_NICK:        Contains your nick.
 * @PURPLE_MESSAGE_NO_LOG:      Do not log.
 * @PURPLE_MESSAGE_ERROR:       Error message.
 * @PURPLE_MESSAGE_DELAYED:     Delayed message.
 * @PURPLE_MESSAGE_RAW:         "Raw" message - don't apply formatting
 * @PURPLE_MESSAGE_IMAGES:      Message contains images
 * @PURPLE_MESSAGE_NOTIFY:      Message is a notification
 * @PURPLE_MESSAGE_NO_LINKIFY:  Message should not be auto-linkified
 * @PURPLE_MESSAGE_INVISIBLE:   Message should not be displayed
 * @PURPLE_MESSAGE_REMOTE_SEND: Message sent from another location,
 *                              not an echo of a local one
 *
 * Flags applicable to a message. Most will have send, recv or system.
 */
typedef enum /*< flags >*/
{
	PURPLE_MESSAGE_SEND        = 0x0001,
	PURPLE_MESSAGE_RECV        = 0x0002,
	PURPLE_MESSAGE_SYSTEM      = 0x0004,
	PURPLE_MESSAGE_AUTO_RESP   = 0x0008,
	PURPLE_MESSAGE_ACTIVE_ONLY = 0x0010,
	PURPLE_MESSAGE_NICK        = 0x0020,
	PURPLE_MESSAGE_NO_LOG      = 0x0040,
	PURPLE_MESSAGE_ERROR       = 0x0200,
	PURPLE_MESSAGE_DELAYED     = 0x0400,
	PURPLE_MESSAGE_RAW         = 0x0800,
	PURPLE_MESSAGE_IMAGES      = 0x1000,
	PURPLE_MESSAGE_NOTIFY      = 0x2000,
	PURPLE_MESSAGE_NO_LINKIFY  = 0x4000,
	PURPLE_MESSAGE_INVISIBLE   = 0x8000,
	PURPLE_MESSAGE_REMOTE_SEND = 0x10000
} PurpleMessageFlags;

#include <glib.h>
#include <glib-object.h>
#include "message.h"

/**************************************************************************/
/* PurpleConversation                                                     */
/**************************************************************************/
/**
 * PurpleConversation:
 * @ui_data: The UI data associated with this conversation. This is a
 *           convenience field provided to the UIs -- it is not used by the
 *           libpurple core.
 *
 * A core representation of a conversation between two or more people.
 *
 * The conversation can be an IM or a chat.
 *
 * Note: When a conversation is destroyed with the last g_object_unref(), the
 *       specified conversation is removed from the parent window. If this
 *       conversation is the only one contained in the parent window, that
 *       window is also destroyed.
 */
struct _PurpleConversation
{
	GObject gparent;

	/*< public >*/
	gpointer ui_data;
};

/**
 * PurpleConversationClass:
 * @write_message: Writes a message to a chat or IM conversation. See
 *                 purple_conversation_write_message().
 *
 * Base class for all #PurpleConversation's
 */
struct _PurpleConversationClass {
	GObjectClass parent_class;

	void (*write_message)(PurpleConversation *conv, PurpleMessage *msg);

	/*< private >*/
	void (*_purple_reserved1)(void);
	void (*_purple_reserved2)(void);
	void (*_purple_reserved3)(void);
	void (*_purple_reserved4)(void);
};

#include "account.h"
#include "buddyicon.h"
#include "e2ee.h"
#include "log.h"
#include "smiley-list.h"

/**************************************************************************/
/* PurpleConversationUiOps                                                */
/**************************************************************************/
/**
 * PurpleConversationUiOps:
 * @create_conversation: Called when @conv is created (but before the
 *   <link linkend="conversations-conversation-created"><literal>"conversation-created"</literal></link>
 *                       signal is emitted).
 * @destroy_conversation: Called just before @conv is freed.
 * @write_chat: Write a message to a chat. If this field is %NULL, libpurple
 *              will fall back to using @write_conv.
 *              See purple_conversation_write_message().
 * @write_im: Write a message to an IM conversation. If this field is %NULL,
 *            libpurple will fall back to using @write_conv.
 *            See purple_conversation_write_message().
 * @write_conv: Write a message to a conversation. This is used rather than the
 *              chat- or im-specific ops for errors, system messages (such as "x
 *              is now know as y"), and as the fallback if @write_im and
 *              @write_chat are not implemented. It should be implemented, or
 *              the UI will miss conversation error messages and your users will
 *              hate you. See purple_conversation_write_message().
 * @chat_add_users: Add @cbuddies to a chat.
 *                  <sbr/>@cbuddies:     A GList of #PurpleChatUser structs.
 *                  <sbr/>@new_arrivals: Whether join notices should be shown.
 *                                       (Join notices are actually written to
 *                                       the conversation by
 *                                       purple_chat_conversation_add_users())
 * @chat_rename_user: Rename the user in this chat named @old_name to @new_name.
 *                    (The rename message is written to the conversation by
 *                    libpurple.) See purple_chat_conversation_rename_user().
 *                    <sbr/>@new_alias: @new_name's new alias, if they have one.
 * @chat_remove_users: Remove @users from a chat @chat.
 *                     See purple_chat_conversation_remove_users().
 * @chat_update_user: Called when a user's flags are changed.
 *                    See purple_chat_user_set_flags().
 * @present: Present this conversation to the user; for example, by displaying
 *           the IM dialog.
 * @has_focus: If this UI has a concept of focus (as in a windowing system) and
 *             this conversation has the focus, return %TRUE; otherwise, return
 *             %FALSE.
 * @send_confirm: Prompt the user for confirmation to send @message. This
 *                function should arrange for the message to be sent if the user
 *                accepts. If this field is %NULL, libpurple will fall back to
 *                using purple_request_action().
 *
 * Conversation operations and events.
 *
 * Any UI representing a conversation must assign a filled-out
 * #PurpleConversationUiOps structure to the #PurpleConversation.
 */
struct _PurpleConversationUiOps
{
	void (*create_conversation)(PurpleConversation *conv);
	void (*destroy_conversation)(PurpleConversation *conv);

	void (*write_chat)(PurpleChatConversation *chat, PurpleMessage *msg);
	void (*write_im)(PurpleIMConversation *im, PurpleMessage *msg);
	void (*write_conv)(PurpleConversation *conv, PurpleMessage *msg);

	void (*chat_add_users)(PurpleChatConversation *chat,
	                       GList *cbuddies,
	                       gboolean new_arrivals);

	void (*chat_rename_user)(PurpleChatConversation *chat, const char *old_name,
	                         const char *new_name, const char *new_alias);

	void (*chat_remove_users)(PurpleChatConversation *chat, GList *users);

	void (*chat_update_user)(PurpleChatUser *cb);

	void (*present)(PurpleConversation *conv);
	gboolean (*has_focus)(PurpleConversation *conv);

	void (*send_confirm)(PurpleConversation *conv, const char *message);

	/*< private >*/
	void (*_purple_reserved1)(void);
	void (*_purple_reserved2)(void);
	void (*_purple_reserved3)(void);
	void (*_purple_reserved4)(void);
};

G_BEGIN_DECLS

/**************************************************************************/
/* Conversation API                                                       */
/**************************************************************************/

/**
 * purple_conversation_get_type:
 *
 * Returns: The #GType for the Conversation object.
 */
GType purple_conversation_get_type(void);

/**
 * purple_conversation_ui_ops_get_type:
 *
 * Returns: The #GType for the #PurpleConversationUiOps boxed structure.
 */
GType purple_conversation_ui_ops_get_type(void);

/**
 * purple_conversation_present:
 * @conv: The conversation to present
 *
 * Present a conversation to the user. This allows core code to initiate a
 * conversation by displaying the IM dialog.
 */
void purple_conversation_present(PurpleConversation *conv);

/**
 * purple_conversation_set_ui_ops:
 * @conv: The conversation.
 * @ops:  The UI conversation operations structure.
 *
 * Sets the specified conversation's UI operations structure.
 */
void purple_conversation_set_ui_ops(PurpleConversation *conv,
								  PurpleConversationUiOps *ops);

/**
 * purple_conversation_get_ui_ops:
 * @conv: The conversation.
 *
 * Returns the specified conversation's UI operations structure.
 *
 * Returns: The operations structure.
 */
PurpleConversationUiOps *purple_conversation_get_ui_ops(PurpleConversation *conv);

/**
 * purple_conversation_set_account:
 * @conv: The conversation.
 * @account: The purple_account.
 *
 * Sets the specified conversation's purple_account.
 *
 * This purple_account represents the user using purple, not the person the user
 * is having a conversation/chat/flame with.
 */
void purple_conversation_set_account(PurpleConversation *conv,
                                   PurpleAccount *account);

/**
 * purple_conversation_get_account:
 * @conv: The conversation.
 *
 * Returns the specified conversation's purple_account.
 *
 * This purple_account represents the user using purple, not the person the user
 * is having a conversation/chat/flame with.
 *
 * Returns: (transfer none): The conversation's purple_account.
 */
PurpleAccount *purple_conversation_get_account(PurpleConversation *conv);

/**
 * purple_conversation_get_connection:
 * @conv: The conversation.
 *
 * Returns the specified conversation's purple_connection.
 *
 * Returns: (transfer none): The conversation's purple_connection.
 */
PurpleConnection *purple_conversation_get_connection(PurpleConversation *conv);

/**
 * purple_conversation_set_title:
 * @conv:  The conversation.
 * @title: The title.
 *
 * Sets the specified conversation's title.
 */
void purple_conversation_set_title(PurpleConversation *conv, const char *title);

/**
 * purple_conversation_get_title:
 * @conv: The conversation.
 *
 * Returns the specified conversation's title.
 *
 * Returns: The title.
 */
const char *purple_conversation_get_title(PurpleConversation *conv);

/**
 * purple_conversation_autoset_title:
 * @conv: The conversation.
 *
 * Automatically sets the specified conversation's title.
 *
 * This function takes OPT_IM_ALIAS_TAB into account, as well as the
 * user's alias.
 */
void purple_conversation_autoset_title(PurpleConversation *conv);

/**
 * purple_conversation_set_name:
 * @conv: The conversation.
 * @name: The conversation's name.
 *
 * Sets the specified conversation's name.
 */
void purple_conversation_set_name(PurpleConversation *conv, const char *name);

/**
 * purple_conversation_get_name:
 * @conv: The conversation.
 *
 * Returns the specified conversation's name.
 *
 * Returns: The conversation's name. If the conversation is an IM with a
 *          PurpleBuddy, then it's the name of the PurpleBuddy.
 */
const char *purple_conversation_get_name(PurpleConversation *conv);

/**
 * purple_conversation_set_e2ee_state:
 * @conv:  The conversation.
 * @state: The E2EE state.
 *
 * Sets current E2EE state for the conversation.
 */
void
purple_conversation_set_e2ee_state(PurpleConversation *conv,
	PurpleE2eeState *state);

/**
 * purple_conversation_get_e2ee_state:
 * @conv: The conversation.
 *
 * Gets current conversation's E2EE state.
 *
 * Returns: (transfer none): Current E2EE state for conversation.
 */
PurpleE2eeState *
purple_conversation_get_e2ee_state(PurpleConversation *conv);

/**
 * purple_conversation_set_logging:
 * @conv: The conversation.
 * @log:  %TRUE if logging should be enabled, or %FALSE otherwise.
 *
 * Enables or disables logging for this conversation.
 */
void purple_conversation_set_logging(PurpleConversation *conv, gboolean log);

/**
 * purple_conversation_is_logging:
 * @conv: The conversation.
 *
 * Returns whether or not logging is enabled for this conversation.
 *
 * Returns: %TRUE if logging is enabled, or %FALSE otherwise.
 */
gboolean purple_conversation_is_logging(PurpleConversation *conv);

/**
 * purple_conversation_close_logs:
 * @conv: The conversation.
 *
 * Closes any open logs for this conversation.
 *
 * Note that new logs will be opened as necessary (e.g. upon receipt of a
 * message, if the conversation has logging enabled. To disable logging for
 * the remainder of the conversation, use purple_conversation_set_logging().
 */
void purple_conversation_close_logs(PurpleConversation *conv);

/**
 * purple_conversation_write_message:
 * @conv: The conversation.
 * @msg:  The message to write.
 *
 * Writes to a chat or an IM.
 */
void purple_conversation_write_message(PurpleConversation *conv,
	PurpleMessage *msg);

/**
 * purple_conversation_write_system_message:
 * @conv:    The conversation.
 * @message: The message to write.
 * @flags:   The message flags (you don't need to set %PURPLE_MESSAGE_SYSTEM.
 *
 * Wites a system message to a chat or an IM.
 */
void purple_conversation_write_system_message(PurpleConversation *conv,
	const gchar *message, PurpleMessageFlags flags);

/**
 * purple_conversation_send:
 * @conv:    The conversation.
 * @message: The message to send.
 *
 * Sends a message to this conversation. This function calls
 * purple_conversation_send_with_flags() with no additional flags.
 */
void purple_conversation_send(PurpleConversation *conv, const char *message);

/**
 * purple_conversation_send_with_flags:
 * @conv:    The conversation.
 * @message: The message to send.
 * @flags:   The PurpleMessageFlags flags to use in addition to
 *           PURPLE_MESSAGE_SEND.
 *
 * Sends a message to this conversation with specified flags.
 */
void purple_conversation_send_with_flags(PurpleConversation *conv, const char *message,
		PurpleMessageFlags flags);

/**
 * purple_conversation_set_features:
 * @conv:      The conversation
 * @features:  Bitset defining supported features
 *
 * Set the features as supported for the given conversation.
 */
void purple_conversation_set_features(PurpleConversation *conv,
		PurpleConnectionFlags features);


/**
 * purple_conversation_get_features:
 * @conv:  The conversation
 *
 * Get the features supported by the given conversation.
 */
PurpleConnectionFlags purple_conversation_get_features(PurpleConversation *conv);

/**
 * purple_conversation_has_focus:
 * @conv:    The conversation.
 *
 * Determines if a conversation has focus
 *
 * Returns: %TRUE if the conversation has focus, %FALSE if
 * it does not or the UI does not have a concept of conversation focus
 */
gboolean purple_conversation_has_focus(PurpleConversation *conv);

/**
 * purple_conversation_update:
 * @conv: The conversation.
 * @type: The update type.
 *
 * Updates the visual status and UI of a conversation.
 */
void purple_conversation_update(PurpleConversation *conv, PurpleConversationUpdateType type);

/**
 * purple_conversation_get_message_history:
 * @conv:   The conversation
 *
 * Retrieve the message history of a conversation.
 *
 * Returns: (element-type PurpleMessage) (transfer none):
 *          A GList of PurpleMessage's. You must not modify the
 *          list or the data within. The list contains the newest message at
 *          the beginning, and the oldest message at the end.
 */
GList *purple_conversation_get_message_history(PurpleConversation *conv);

/**
 * purple_conversation_clear_message_history:
 * @conv:  The conversation
 *
 * Clear the message history of a conversation.
 */
void purple_conversation_clear_message_history(PurpleConversation *conv);

/**
 * purple_conversation_set_ui_data:
 * @conv:			The conversation.
 * @ui_data:		A pointer to associate with this conversation.
 *
 * Set the UI data associated with this conversation.
 *
 * Since: 3.0.0
 */
void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data);

/**
 * purple_conversation_get_ui_data:
 * @conv:			The conversation.
 *
 * Get the UI data associated with this conversation.
 *
 * Returns: (transfer none): The UI data associated with this conversation.
 *         This is a convenience field provided to the UIs--it is not
 *         used by the libpurple core.
 *
 * Since: 3.0.0
 */
gpointer purple_conversation_get_ui_data(const PurpleConversation *conv);

/**
 * purple_conversation_send_confirm:
 * @conv:    The conversation.
 * @message: The message to send.
 *
 * Sends a message to a conversation after confirming with
 * the user.
 *
 * This function is intended for use in cases where the user
 * hasn't explicitly and knowingly caused a message to be sent.
 * The confirmation ensures that the user isn't sending a
 * message by mistake.
 */
void purple_conversation_send_confirm(PurpleConversation *conv, const char *message);

/**
 * purple_conversation_get_extended_menu:
 * @conv: The conversation.
 *
 * Retrieves the extended menu items for the conversation.
 *
 * Returns: (element-type PurpleActionMenu) (transfer full): The extended menu
 *          items for a conversation, as harvested by the chat-extended-menu
 *          signal.
 */
GList * purple_conversation_get_extended_menu(PurpleConversation *conv);

/**
 * purple_conversation_do_command:
 * @conv:    The conversation.
 * @cmdline: The entire command including the arguments.
 * @markup:  %NULL, or the formatted command line.
 * @error:   If the command failed errormsg is filled in with the appropriate error
 *                message, if not %NULL. It must be freed by the caller with g_free().
 *
 * Perform a command in a conversation. Similar to purple_cmd_do_command().
 *
 * Returns:  %TRUE if the command was executed successfully, %FALSE otherwise.
 */
gboolean purple_conversation_do_command(PurpleConversation *conv,
		const gchar *cmdline, const gchar *markup, gchar **error);

/**
 * purple_conversation_get_max_message_size:
 * @conv: The conversation to query.
 *
 * Gets the maximum message size in bytes for the conversation.
 *
 * See #PurpleProtocolClientInterface's <literal>get_max_message_size</literal>.
 *
 * Returns: Maximum message size, 0 if unspecified, -1 for infinite.
 */
gssize
purple_conversation_get_max_message_size(PurpleConversation *conv);

/**
 * purple_conversation_add_smiley:
 * @conv: The conversation that receives new smiley.
 * @smiley: The smiley.
 *
 * Adds a smiley to the list of smileys that belong to this conversation.
 */
void purple_conversation_add_smiley(PurpleConversation *conv, PurpleSmiley *smiley);

/**
 * purple_conversation_get_smiley:
 * @conv: The conversation.
 * @shortcut: The shortcut.
 *
 * Lookups for the smiley previously added to this conversation.
 *
 * Returns: (transfer none): The smiley, or %NULL if it doesn't exists.
 */
PurpleSmiley *purple_conversation_get_smiley(PurpleConversation *conv, const gchar *shortcut);

/**
 * purple_conversation_get_remote_smileys:
 * @conv: The conversation.
 *
 * Get all remote smileys previously added to this conversation.
 *
 * Returns: (transfer none): The list of remote smileys.
 */
PurpleSmileyList *
purple_conversation_get_remote_smileys(PurpleConversation *conv);

/**************************************************************************/
/* Conversation Helper API                                                */
/**************************************************************************/

/**
 * purple_conversation_present_error:
 * @who:     The user this error is about
 * @account: The account this error is on
 * @what:    The error
 *
 * Presents an IM-error to the user
 *
 * This is a helper function to find a conversation, write an error to it, and
 * raise the window.  If a conversation with this user doesn't already exist,
 * the function will return FALSE and the calling function can attempt to present
 * the error another way (purple_notify_error, most likely)
 *
 * Returns:        TRUE if the error was presented, else FALSE
 */
gboolean purple_conversation_present_error(const char *who, PurpleAccount *account, const char *what);

G_END_DECLS

#endif /* PURPLE_CONVERSATION_H */