2 * @file conversation.h Conversation API
6 * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #ifndef _GAIM_CONVERSATION_H_
25 #define _GAIM_CONVERSATION_H_
27 /**************************************************************************/
28 /** Data Structures */
29 /**************************************************************************/
31 typedef enum _GaimConversationType GaimConversationType
;
32 typedef enum _GaimUnseenState GaimUnseenState
;
33 typedef enum _GaimConvUpdateType GaimConvUpdateType
;
34 struct gaim_window_ui_ops
;
36 struct gaim_conversation
;
41 * A type of conversation.
43 enum _GaimConversationType
45 GAIM_CONV_UNKNOWN
= 0, /**< Unknown conversation type. */
46 GAIM_CONV_IM
, /**< Instant Message. */
47 GAIM_CONV_CHAT
, /**< Chat room. */
48 GAIM_CONV_MISC
/**< A misc. conversation. */
56 GAIM_UNSEEN_NONE
= 0, /**< No unseen text in the conversation. */
57 GAIM_UNSEEN_TEXT
, /**< Unseen text in the conversation. */
58 GAIM_UNSEEN_NICK
, /**< Unseen text and the nick was said. */
62 * Conversation update type.
64 enum _GaimConvUpdateType
66 GAIM_CONV_UPDATE_ADD
= 0, /**< The buddy associated with the conversation
68 GAIM_CONV_UPDATE_REMOVE
, /**< The buddy associated with the conversation
70 GAIM_CONV_UPDATE_ACCOUNT
, /**< The gaim_account was changed. */
71 GAIM_CONV_UPDATE_TYPING
, /**< The typing state was updated. */
72 GAIM_CONV_UPDATE_UNSEEN
, /**< The unseen state was updated. */
73 GAIM_CONV_UPDATE_LOGGING
, /**< Logging for this conversation was
74 enabled or disabled. */
75 GAIM_CONV_UPDATE_TOPIC
, /**< The topic for a chat was updated. */
78 * XXX These need to go when we implement a more generic core/UI event
81 GAIM_CONV_ACCOUNT_ONLINE
, /**< One of the user's accounts went online. */
82 GAIM_CONV_ACCOUNT_OFFLINE
, /**< One of the user's accounts went offline. */
83 GAIM_CONV_UPDATE_AWAY
/**< The other user went away. */
86 /* Yeah, this has to be included here. Ugh. */
90 * Conversation window operations.
92 * Any UI representing a window must assign a filled-out gaim_window_ops
93 * structure to the gaim_window.
95 struct gaim_window_ui_ops
97 struct gaim_conversation_ui_ops
*(*get_conversation_ui_ops
)(void);
99 void (*new_window
)(struct gaim_window
*win
);
100 void (*destroy_window
)(struct gaim_window
*win
);
102 void (*show
)(struct gaim_window
*win
);
103 void (*hide
)(struct gaim_window
*win
);
104 void (*raise
)(struct gaim_window
*win
);
105 void (*flash
)(struct gaim_window
*win
);
107 void (*switch_conversation
)(struct gaim_window
*win
, unsigned int index
);
108 void (*add_conversation
)(struct gaim_window
*win
,
109 struct gaim_conversation
*conv
);
110 void (*remove_conversation
)(struct gaim_window
*win
,
111 struct gaim_conversation
*conv
);
112 void (*move_conversation
)(struct gaim_window
*win
,
113 struct gaim_conversation
*conv
,
114 unsigned int newIndex
);
115 int (*get_active_index
)(const struct gaim_window
*win
);
119 * Conversation operations and events.
121 * Any UI representing a conversation must assign a filled-out
122 * gaim_conversation_ui_ops structure to the gaim_conversation.
124 struct gaim_conversation_ui_ops
126 void (*destroy_conversation
)(struct gaim_conversation
*conv
);
127 void (*write_chat
)(struct gaim_conversation
*conv
, const char *who
,
128 const char *message
, int flags
, time_t mtime
);
129 void (*write_im
)(struct gaim_conversation
*conv
, const char *who
,
130 const char *message
, size_t len
, int flags
, time_t mtime
);
131 void (*write_conv
)(struct gaim_conversation
*conv
, const char *who
,
132 const char *message
, size_t length
, int flags
,
135 void (*chat_add_user
)(struct gaim_conversation
*conv
, const char *user
);
136 void (*chat_rename_user
)(struct gaim_conversation
*conv
,
137 const char *old_name
, const char *new_name
);
138 void (*chat_remove_user
)(struct gaim_conversation
*conv
, const char *user
);
140 void (*set_title
)(struct gaim_conversation
*conv
,
142 void (*update_progress
)(struct gaim_conversation
*conv
, float percent
);
145 void (*updated
)(struct gaim_conversation
*conv
, GaimConvUpdateType type
);
149 * A core representation of a graphical window containing one or more
154 GList
*conversations
; /**< The conversations in the window. */
155 size_t conversation_count
; /**< The number of conversations. */
157 struct gaim_window_ui_ops
*ui_ops
; /**< UI-specific window operations. */
158 void *ui_data
; /**< UI-specific data. */
162 * Data specific to Instant Messages.
166 struct gaim_conversation
*conv
; /**< The parent conversation. */
168 int typing_state
; /**< The current typing state. */
169 guint typing_timeout
; /**< The typing timer handle. */
170 time_t type_again
; /**< The type again time. */
171 guint type_again_timeout
; /**< The type again timer handle. */
173 GSList
*images
; /**< A list of images in the IM. */
177 * Data specific to Chats.
181 struct gaim_conversation
*conv
; /**< The parent conversation. */
183 GList
*in_room
; /**< The users in the room. */
184 GList
*ignored
; /**< Ignored users. */
185 char *who
; /**< The person who set the topic. */
186 char *topic
; /**< The topic. */
187 int id
; /**< The chat ID. */
191 * A core representation of a conversation between two or more people.
193 * The conversation can be an IM or a chat. Each conversation is kept
194 * in a gaim_window and has a UI representation.
196 struct gaim_conversation
198 GaimConversationType type
; /**< The type of conversation. */
200 struct gaim_account
*account
; /**< The user using this conversation. */
201 struct gaim_window
*window
; /**< The parent window. */
203 int conversation_pos
; /**< The position in the window's list. */
205 char *name
; /**< The name of the conversation. */
206 char *title
; /**< The window title. */
208 gboolean logging
; /**< The status of logging. */
210 GList
*send_history
; /**< The send history. */
211 GString
*history
; /**< The conversation history. */
213 GaimUnseenState unseen
; /**< The unseen tab state. */
217 struct gaim_im
*im
; /**< IM-specific data. */
218 struct gaim_chat
*chat
; /**< Chat-specific data. */
219 void *misc
; /**< Misc. data. */
223 struct gaim_conversation_ui_ops
*ui_ops
; /**< UI-specific operations. */
224 void *ui_data
; /**< UI-specific data. */
226 GHashTable
*data
; /**< Plugin-specific data. */
229 typedef void (*gaim_conv_placement_fnc
)(struct gaim_conversation
*);
231 /**************************************************************************/
232 /** @name Conversation Window API */
233 /**************************************************************************/
237 * Creates a new conversation window.
239 * This window is added to the list of windows, but is not shown until
240 * gaim_window_show() is called.
242 * @return The new conversation window.
244 struct gaim_window
*gaim_window_new(void);
247 * Destroys the specified conversation window and all conversations in it.
249 * @param win The window to destroy.
251 void gaim_window_destroy(struct gaim_window
*win
);
254 * Shows the specified conversation window.
256 * @param win The window.
258 void gaim_window_show(struct gaim_window
*win
);
261 * Hides the specified conversation window.
263 * @param win The window.
265 void gaim_window_hide(struct gaim_window
*win
);
268 * Raises the specified conversation window.
270 * @param win The window.
272 void gaim_window_raise(struct gaim_window
*win
);
275 * Causes the window to flash for IM notification, if the UI supports this.
277 * @param win The window.
279 void gaim_window_flash(struct gaim_window
*win
);
282 * Sets the specified window's UI window operations structure.
284 * @param win The window.
285 * @param ops The UI window operations structure.
287 void gaim_window_set_ui_ops(struct gaim_window
*win
,
288 struct gaim_window_ui_ops
*ops
);
291 * Returns the specified window's UI window operations structure.
293 * @param win The window.
295 * @return The UI window operations structure.
297 struct gaim_window_ui_ops
*gaim_window_get_ui_ops(
298 const struct gaim_window
*win
);
301 * Adds a conversation to this window.
303 * If the conversation already has a parent window, this will do nothing.
305 * @param win The window.
306 * @param conv The conversation.
308 * @return The new index of the conversation in the window.
310 int gaim_window_add_conversation(struct gaim_window
*win
,
311 struct gaim_conversation
*conv
);
314 * Removes the conversation at the specified index from the window.
316 * If there is no conversation at this index, this will do nothing.
318 * @param win The window.
319 * @param index The index of the conversation.
321 * @return The conversation removed.
323 struct gaim_conversation
*gaim_window_remove_conversation(
324 struct gaim_window
*win
, unsigned int index
);
327 * Moves the conversation at the specified index in a window to a new index.
329 * @param win The window.
330 * @param index The index of the conversation to move.
331 * @param new_index The new index.
333 void gaim_window_move_conversation(struct gaim_window
*win
,
334 unsigned int index
, unsigned int new_index
);
337 * Returns the conversation in the window at the specified index.
339 * If the index is out of range, this returns @c NULL.
341 * @param win The window.
342 * @param index The index containing a conversation.
344 * @return The conversation at the specified index.
346 struct gaim_conversation
*gaim_window_get_conversation_at(
347 const struct gaim_window
*win
, unsigned int index
);
350 * Returns the number of conversations in the window.
352 * @param win The window.
354 * @return The number of conversations.
356 size_t gaim_window_get_conversation_count(const struct gaim_window
*win
);
359 * Switches the active conversation to the one at the specified index.
361 * If @a index is out of range, this does nothing.
363 * @param win The window.
364 * @param index The new index.
366 void gaim_window_switch_conversation(struct gaim_window
*win
,
370 * Returns the active conversation in the window.
372 * @param win The window.
374 * @return The active conversation.
376 struct gaim_conversation
*gaim_window_get_active_conversation(
377 const struct gaim_window
*win
);
380 * Returns the list of conversations in the specified window.
382 * @param win The window.
384 * @return The list of conversations.
386 GList
*gaim_window_get_conversations(const struct gaim_window
*win
);
389 * Returns a list of all windows.
391 * @return A list of windows.
393 GList
*gaim_get_windows(void);
396 * Returns the first window containing a conversation of the specified type.
398 * @param type The conversation type.
400 * @return The window if found, or @c NULL if not found.
402 struct gaim_window
*gaim_get_first_window_with_type(GaimConversationType type
);
405 * Returns the last window containing a conversation of the specified type.
407 * @param type The conversation type.
409 * @return The window if found, or @c NULL if not found.
411 struct gaim_window
*gaim_get_last_window_with_type(GaimConversationType type
);
415 /**************************************************************************/
416 /** @name Conversation API */
417 /**************************************************************************/
421 * Creates a new conversation of the specified type.
423 * @param type The type of conversation.
424 * @param user The account opening the conversation window on the gaim
426 * @param name The name of the conversation.
428 * @return The new conversation.
430 struct gaim_conversation
*gaim_conversation_new(GaimConversationType type
,
431 struct gaim_account
*account
,
435 * Destroys the specified conversation and removes it from the parent
438 * If this conversation is the only one contained in the parent window,
439 * that window is also destroyed.
441 * @param conv The conversation to destroy.
443 void gaim_conversation_destroy(struct gaim_conversation
*conv
);
446 * Returns the specified conversation's type.
448 * @param conv The conversation.
450 * @return The conversation's type.
452 GaimConversationType
gaim_conversation_get_type(
453 const struct gaim_conversation
*conv
);
456 * Sets the specified conversation's UI operations structure.
458 * @param conv The conversation.
459 * @param ops The UI conversation operations structure.
461 void gaim_conversation_set_ui_ops(struct gaim_conversation
*conv
,
462 struct gaim_conversation_ui_ops
*ops
);
465 * Returns the specified conversation's UI operations structure.
467 * @param conv The conversation.
469 * @return The operations structure.
471 struct gaim_conversation_ui_ops
*gaim_conversation_get_ui_ops(
472 struct gaim_conversation
*conv
);
475 * Sets the specified conversation's gaim_account.
477 * This gaim_account represents the user using gaim, not the person the user
478 * is having a conversation/chat/flame with.
480 * @param conv The conversation.
481 * @param account The gaim_account.
483 void gaim_conversation_set_account(struct gaim_conversation
*conv
,
484 struct gaim_account
*account
);
487 * Returns the specified conversation's gaim_account.
489 * This gaim_account represents the user using gaim, not the person the user
490 * is having a conversation/chat/flame with.
492 * @param conv The conversation.
494 * @return The conversation's gaim_account.
496 struct gaim_account
*gaim_conversation_get_account(
497 const struct gaim_conversation
*conv
);
500 * Returns the specified conversation's gaim_connection.
502 * This is the same as gaim_conversation_get_user(conv)->gc.
504 * @param conv The conversation.
506 * @return The conversation's gaim_connection.
508 struct gaim_connection
*gaim_conversation_get_gc(
509 const struct gaim_conversation
*conv
);
512 * Sets the specified conversation's title.
514 * @param conv The conversation.
515 * @param title The title.
517 void gaim_conversation_set_title(struct gaim_conversation
*conv
,
521 * Returns the specified conversation's title.
523 * @param win The conversation.
527 const char *gaim_conversation_get_title(const struct gaim_conversation
*conv
);
530 * Automatically sets the specified conversation's title.
532 * This function takes OPT_IM_ALIAS_TAB into account, as well as the
535 * @param conv The conversation.
537 void gaim_conversation_autoset_title(struct gaim_conversation
*conv
);
540 * Returns the specified conversation's index in the parent window.
542 * @param conv The conversation.
544 * @return The current index in the parent window.
546 int gaim_conversation_get_index(const struct gaim_conversation
*conv
);
549 * Sets the conversation's unseen state.
551 * @param conv The conversation.
552 * @param state The new unseen state.
554 void gaim_conversation_set_unseen(struct gaim_conversation
*conv
,
555 GaimUnseenState state
);
558 * Returns the conversation's unseen state.
560 * @param conv The conversation.
562 * @param The conversation's unseen state.
564 GaimUnseenState
gaim_conversation_get_unseen(
565 const struct gaim_conversation
*conv
);
568 * Returns the specified conversation's name.
570 * @param conv The conversation.
572 * @return The conversation's name.
574 const char *gaim_conversation_get_name(const struct gaim_conversation
*conv
);
577 * Enables or disables logging for this conversation.
579 * @param log @c TRUE if logging should be enabled, or @c FALSE otherwise.
581 void gaim_conversation_set_logging(struct gaim_conversation
*conv
,
585 * Returns whether or not logging is enabled for this conversation.
587 * @return @c TRUE if logging is enabled, or @c FALSE otherwise.
589 gboolean
gaim_conversation_is_logging(const struct gaim_conversation
*conv
);
592 * Returns the specified conversation's send history.
594 * @param conv The conversation.
596 * @return The conversation's send history.
598 GList
*gaim_conversation_get_send_history(
599 const struct gaim_conversation
*conv
);
602 * Sets the specified conversation's history.
604 * @param conv The conversation.
605 * @param history The history.
607 void gaim_conversation_set_history(struct gaim_conversation
*conv
,
611 * Returns the specified conversation's history.
613 * @param conv The conversation.
615 * @return The conversation's history.
617 GString
*gaim_conversation_get_history(const struct gaim_conversation
*conv
);
620 * Returns the specified conversation's parent window.
622 * @param conv The conversation.
624 * @return The conversation's parent window.
626 struct gaim_window
*gaim_conversation_get_window(
627 const struct gaim_conversation
*conv
);
630 * Returns the specified conversation's IM-specific data.
632 * If the conversation type is not GAIM_CONV_IM, this will return @c NULL.
634 * @param conv The conversation.
636 * @return The IM-specific data.
638 struct gaim_im
*gaim_conversation_get_im_data(
639 const struct gaim_conversation
*conv
);
641 #define GAIM_IM(c) (gaim_conversation_get_im_data(c))
644 * Returns the specified conversation's chat-specific data.
646 * If the conversation type is not GAIM_CONV_CHAT, this will return @c NULL.
648 * @param conv The conversation.
650 * @return The chat-specific data.
652 struct gaim_chat
*gaim_conversation_get_chat_data(
653 const struct gaim_conversation
*conv
);
655 #define GAIM_CHAT(c) (gaim_conversation_get_chat_data(c))
658 * Sets extra data for a conversation.
660 * @param conv The conversation.
661 * @param key The unique key.
662 * @param data The data to assign.
664 void gaim_conversation_set_data(struct gaim_conversation
*conv
,
665 const char *key
, gpointer data
);
668 * Returns extra data in a conversation.
670 * @param conv The conversation.
671 * @param key The unqiue key.
673 * @return The data associated with the key.
675 gpointer
gaim_conversation_get_data(struct gaim_conversation
*conv
,
679 * Returns a list of all conversations.
681 * This list includes both IMs and chats.
683 * @return A GList of all conversations.
685 GList
*gaim_get_conversations(void);
688 * Returns a list of all IMs.
690 * @return A GList of all IMs.
692 GList
*gaim_get_ims(void);
695 * Returns a list of all chats.
697 * @return A GList of all chats.
699 GList
*gaim_get_chats(void);
702 * Finds the conversation with the specified name.
704 * @param name The name of the conversation.
706 * @return The conversation if found, or @c NULL otherwise.
708 struct gaim_conversation
*gaim_find_conversation(const char *name
);
711 * Finds a conversation with the specified name and user.
713 * @param name The name of the conversation.
714 * @param account The gaim_account associated with the conversation.
716 * @return The conversation if found, or @c NULL otherwise.
718 struct gaim_conversation
*gaim_find_conversation_with_account(
719 const char *name
, const struct gaim_account
*account
);
722 * Writes to a conversation window.
724 * This function should not be used to write IM or chat messages. Use
725 * gaim_im_write() and gaim_chat_write() instead. Those functions will
726 * most likely call this anyway, but they may do their own formatting,
727 * sound playback, etc.
729 * This can be used to write generic messages, such as "so and so closed
730 * the conversation window."
732 * @param conv The conversation.
733 * @param who The user who sent the message.
734 * @param message The message.
735 * @param length The length of the message.
736 * @param flags The flags.
737 * @param mtime The time the message was sent.
739 * @see gaim_im_write()
740 * @see gaim_chat_write()
742 void gaim_conversation_write(struct gaim_conversation
*conv
, const char *who
,
743 const char *message
, size_t length
, int flags
,
747 * Updates the progress bar on a conversation window
748 * (if one exists in the UI).
750 * This is used for loading images typically.
752 * @param conv The conversation.
753 * @param percent The percentage.
755 void gaim_conversation_update_progress(struct gaim_conversation
*conv
,
759 * Updates the visual status and UI of a conversation.
761 * @param conv The conversation.
762 * @param type The update type.
764 void gaim_conversation_update(struct gaim_conversation
*conv
,
765 GaimConvUpdateType type
);
768 * Calls a function on each conversation.
770 * @param func The function.
772 void gaim_conversation_foreach(void (*func
)(struct gaim_conversation
*conv
));
777 /**************************************************************************/
778 /** @name IM Conversation API */
779 /**************************************************************************/
783 * Gets an IM's parent conversation.
787 * @return The parent conversation.
789 struct gaim_conversation
*gaim_im_get_conversation(struct gaim_im
*im
);
792 * Sets the IM's typing state.
795 * @param state The typing state.
797 void gaim_im_set_typing_state(struct gaim_im
*im
, int state
);
800 * Returns the IM's typing state.
804 * @return The IM's typing state.
806 int gaim_im_get_typing_state(const struct gaim_im
*im
);
809 * Starts the IM's typing timeout.
812 * @param timeout The timeout.
814 void gaim_im_start_typing_timeout(struct gaim_im
*im
, int timeout
);
817 * Stops the IM's typing timeout.
821 void gaim_im_stop_typing_timeout(struct gaim_im
*im
);
824 * Returns the IM's typing timeout.
828 * @return The timeout.
830 guint
gaim_im_get_typing_timeout(const struct gaim_im
*im
);
833 * Sets the IM's time until it should send another typing notification.
836 * @param val The time.
838 void gaim_im_set_type_again(struct gaim_im
*im
, time_t val
);
841 * Returns the IM's time until it should send another typing notification.
847 time_t gaim_im_get_type_again(const struct gaim_im
*im
);
850 * Starts the IM's type again timeout.
854 void gaim_im_start_type_again_timeout(struct gaim_im
*im
);
857 * Stops the IM's type again timeout.
861 void gaim_im_stop_type_again_timeout(struct gaim_im
*im
);
864 * Returns the IM's type again timeout interval.
868 * @return The type again timeout interval.
870 guint
gaim_im_get_type_again_timeout(const struct gaim_im
*im
);
873 * Updates the visual typing notification for an IM conversation.
877 void gaim_im_update_typing(struct gaim_im
*im
);
882 * The @a len parameter is used for writing binary data, such as an
883 * image. If @c message is text, specify -1 for @a len.
886 * @param who The user who sent the message.
887 * @param message The message to write.
888 * @param len The length of the message, or -1 to specify the length
890 * @param flag The flags.
891 * @param mtime The time the message was sent.
893 void gaim_im_write(struct gaim_im
*im
, const char *who
,
894 const char *message
, size_t len
, int flag
, time_t mtime
);
897 * Sends a message to this IM conversation.
900 * @param message The message to send.
902 void gaim_im_send(struct gaim_im
*im
, const char *message
);
907 /**************************************************************************/
908 /** @name Chat Conversation API */
909 /**************************************************************************/
913 * Gets a chat's parent conversation.
915 * @param chat The chat.
917 * @return The parent conversation.
919 struct gaim_conversation
*gaim_chat_get_conversation(struct gaim_chat
*chat
);
922 * Sets the list of users in the chat room.
924 * @param chat The chat.
925 * @param users The list of users.
927 * @return The list passed.
929 GList
*gaim_chat_set_users(struct gaim_chat
*chat
, GList
*users
);
932 * Returns a list of users in the chat room.
934 * @param chat The chat.
936 * @return The list of users.
938 GList
*gaim_chat_get_users(const struct gaim_chat
*chat
);
941 * Ignores a user in a chat room.
943 * @param chat The chat.
944 * @param name The name of the user.
946 void gaim_chat_ignore(struct gaim_chat
*chat
, const char *name
);
949 * Unignores a user in a chat room.
951 * @param chat The chat.
952 * @param name The name of the user.
954 void gaim_chat_unignore(struct gaim_chat
*chat
, const char *name
);
957 * Sets the list of ignored users in the chat room.
959 * @param chat The chat.
960 * @param ignored The list of ignored users.
962 * @return The list passed.
964 GList
*gaim_chat_set_ignored(struct gaim_chat
*chat
, GList
*ignored
);
967 * Returns the list of ignored users in the chat room.
969 * @param chat The chat.
971 * @return The list of ignored users.
973 GList
*gaim_chat_get_ignored(const struct gaim_chat
*chat
);
976 * Returns the actual name of the specified ignored user, if it exists in
979 * If the user found contains a prefix, such as '+' or '\@', this is also
980 * returned. The username passed to the function does not have to have this
983 * @param chat The chat.
984 * @param user The user to check in the ignore list.
986 * @return The ignored user if found, complete with prefixes, or @c NULL
989 const char *gaim_chat_get_ignored_user(const struct gaim_chat
*chat
,
993 * Returns @c TRUE if the specified user is ignored.
995 * @param chat The chat.
996 * @param user The user.
998 * @return @c TRUE if the user is in the ignore list; @c FALSE otherwise.
1000 gboolean
gaim_chat_is_user_ignored(const struct gaim_chat
*chat
,
1004 * Sets the chat room's topic.
1006 * @param chat The chat.
1007 * @param who The user that set the topic.
1008 * @param topic The topic.
1010 void gaim_chat_set_topic(struct gaim_chat
*chat
, const char *who
,
1014 * Returns the chat room's topic.
1016 * @param chat The chat.
1018 * @return The chat's topic.
1020 const char *gaim_chat_get_topic(const struct gaim_chat
*chat
);
1023 * Sets the chat room's ID.
1025 * @param chat The chat.
1028 void gaim_chat_set_id(struct gaim_chat
*chat
, int id
);
1031 * Returns the chat room's ID.
1033 * @param chat The chat.
1037 int gaim_chat_get_id(const struct gaim_chat
*chat
);
1042 * @param chat The chat.
1043 * @param who The user who sent the message.
1044 * @param message The message to write.
1045 * @param flag The flags.
1046 * @param mtime The time the message was sent.
1048 void gaim_chat_write(struct gaim_chat
*chat
, const char *who
,
1049 const char *message
, int flag
, time_t mtime
);
1052 * Sends a message to this chat conversation.
1054 * @param chat The chat.
1055 * @param message The message to send.
1057 void gaim_chat_send(struct gaim_chat
*chat
, const char *message
);
1060 * Adds a user to a chat.
1062 * @param chat The chat.
1063 * @param user The user to add.
1064 * @param extra_msg An extra message to display with the join message.
1066 void gaim_chat_add_user(struct gaim_chat
*chat
, const char *user
,
1067 const char *extra_msg
);
1070 * Renames a user in a chat.
1072 * @param chat The chat.
1073 * @param old_user The old username.
1074 * @param new_user The new username.
1076 void gaim_chat_rename_user(struct gaim_chat
*chat
, const char *old_user
,
1077 const char *new_user
);
1080 * Removes a user from a chat, optionally with a reason.
1082 * @param chat The chat.
1083 * @param user The user that is being removed.
1084 * @param reason The optional reason given for the removal. Can be @c NULL.
1086 void gaim_chat_remove_user(struct gaim_chat
*chat
, const char *user
,
1087 const char *reason
);
1090 * Finds a chat with the specified chat ID.
1092 * @param gc The gaim_connection.
1093 * @param id The chat ID.
1095 * @return The chat conversation.
1097 struct gaim_conversation
*gaim_find_chat(struct gaim_connection
*gc
, int id
);
1101 /**************************************************************************/
1102 /** @name Conversation Placement Functions */
1103 /**************************************************************************/
1107 * Adds a conversation placement function to the list of possible functions.
1109 * @param name The name of the function.
1110 * @param fnc A pointer to the function.
1112 * @return The index of this entry.
1114 int gaim_conv_placement_add_fnc(const char *name
, gaim_conv_placement_fnc fnc
);
1117 * Removes a conversation placement function from the list of possible
1120 * @param index The index of the function.
1122 void gaim_conv_placement_remove_fnc(int index
);
1125 * Returns the number of conversation placement functions.
1127 * @return The number of registered functions.
1129 int gaim_conv_placement_get_fnc_count(void);
1132 * Returns the name of the conversation placement function at the
1135 * @param index The index.
1137 * @return The name of the function, or @c NULL if this index is out of
1140 const char *gaim_conv_placement_get_name(int index
);
1143 * Returns a pointer to the conversation placement function at the
1146 * @param index The index.
1148 * @return A pointer to the function.
1150 gaim_conv_placement_fnc
gaim_conv_placement_get_fnc(int index
);
1153 * Returns the index of the specified conversation placement function.
1155 * @param fnc A pointer to the registered function.
1157 * @return The index of the conversation, or -1 if the function is not
1160 int gaim_conv_placement_get_fnc_index(gaim_conv_placement_fnc fnc
);
1163 * Returns the index of the active conversation placement function.
1165 * @param index The index of the active function.
1167 int gaim_conv_placement_get_active(void);
1170 * Sets the active conversation placement function.
1172 * @param index The index of the function.
1174 void gaim_conv_placement_set_active(int index
);
1178 /**************************************************************************/
1179 /** @name UI Registration Functions */
1180 /**************************************************************************/
1184 * Sets the UI operations structure to be used in all gaim conversation
1187 * @param fnc The function.
1189 void gaim_set_win_ui_ops(struct gaim_window_ui_ops
*ops
);
1192 * Returns the gaim window UI operations structure to be used in
1195 * @return A filled-out gaim_window_ui_ops structure.
1197 struct gaim_window_ui_ops
*gaim_get_win_ui_ops(void);
1201 #endif /* _GAIM_CONVERSATION_H_ */