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