diff src/conversation.h @ 9554:8b2451878e26

[gaim-migrate @ 10387] " This patch adds chat user status icons (voice / halfop / op / founder) to chats There's a screenshot here, showing ops, voices and ignored ops and voices http://nosnilmot.com/gaim/chatusers.png This required some changes in how the core stores the list of users in chats to be able to store the status too, which are detailed below. I also fixed up some memory leaks as I came across them (string values returned by gtk_tree_model_get() not being g_free()'d) and a minor bug in signals-test.c Conversation API: Changed: gaim_conv_chat_add_user() (added flags parameter) gaim_conv_chat_add_users() now (added GList of flags parameter) gaim_conv_chat_get_users() now returns a GList of GaimChatBuddy's gaim_conv_chat_set_users() now expects a GList of GaimChatBuddy's Added: gaim_conv_chat_set_user_flags() gaim_conv_chat_get_user_flags() gaim_conv_chat_find_user() gaim_conv_chat_cb_new() gaim_conv_chat_cb_find() gaim_conv_chat_cb_destroy() gaim_conv_chat_cb_get_name() Conversation UI ops: added: chat_update_user() Signals: Changed: chat-buddy-joining & chat-buddy-joined now include the user's flags Added: chat-buddy-flags for when user's flags change Added: gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT (required for the new chat-buddy-flags signal) Protocol Plugins: All updated to work with above changes (obviously) User flags support added to IRC, Jabber and SILC New Files: pixmaps/status/default/ voice.svg halfop.svg op.svg founder.svg " --Stu Tomlinson committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 17 Jul 2004 18:11:12 +0000
parents 947876140943
children fe35f55ee984
line wrap: on
line diff
--- a/src/conversation.h	Sat Jul 17 17:08:24 2004 +0000
+++ b/src/conversation.h	Sat Jul 17 18:11:12 2004 +0000
@@ -37,6 +37,7 @@
 typedef struct _GaimConversation      GaimConversation;
 typedef struct _GaimConvIm            GaimConvIm;
 typedef struct _GaimConvChat          GaimConvChat;
+typedef struct _GaimConvChatBuddy     GaimConvChatBuddy;
 
 /**
  * A type of conversation.
@@ -118,6 +119,18 @@
 	GAIM_MESSAGE_ERROR     = 0x0200  /**< Error message.           */
 } GaimMessageFlags;
 
+/**
+ * Flags applicable to users in Chats.
+ */
+typedef enum
+{
+	GAIM_CBFLAGS_NONE          = 0x0000, /**< No flags                     */
+	GAIM_CBFLAGS_VOICE         = 0x0001, /**< Voiced user or "Participant" */
+	GAIM_CBFLAGS_HALFOP        = 0x0002, /**< Half-op                      */
+	GAIM_CBFLAGS_OP            = 0x0004, /**< Channel Op or Moderator      */
+	GAIM_CBFLAGS_FOUNDER       = 0x0008  /**< Channel Founder              */
+} GaimConvChatBuddyFlags;
+
 #include "account.h"
 #include "log.h"
 #include "buddyicon.h"
@@ -175,6 +188,7 @@
 	                         const char *old_name, const char *new_name);
 	void (*chat_remove_user)(GaimConversation *conv, const char *user);
 	void (*chat_remove_users)(GaimConversation *conv, GList *users);
+	void (*chat_update_user)(GaimConversation *conv, const char *user);
 
 	void (*update_progress)(GaimConversation *conv, float percent);
 
@@ -231,6 +245,15 @@
 };
 
 /**
+ * Data for "Chat Buddies"
+ */
+struct _GaimConvChatBuddy
+{
+	char *name;                      /**< The name                      */
+	GaimConvChatBuddyFlags flags;    /**< Flags (ops, voice etc.)       */
+};
+
+/**
  * A core representation of a conversation between two or more people.
  *
  * The conversation can be an IM or a chat. Each conversation is kept
@@ -1150,9 +1173,10 @@
  * @param chat      The chat.
  * @param user      The user to add.
  * @param extra_msg An extra message to display with the join message.
+ * @param flags     The users flags
  */
 void gaim_conv_chat_add_user(GaimConvChat *chat, const char *user,
-							 const char *extra_msg);
+							 const char *extra_msg, GaimConvChatBuddyFlags flags);
 
 /**
  * Adds a list of users to a chat.
@@ -1162,8 +1186,9 @@
  *
  * @param chat      The chat.
  * @param users     The list of users to add.
+ * @param flags     The list of flags for each user.
  */
-void gaim_conv_chat_add_users(GaimConvChat *chat, GList *users);
+void gaim_conv_chat_add_users(GaimConvChat *chat, GList *users, GList *flags);
 
 /**
  * Renames a user in a chat.
@@ -1198,6 +1223,37 @@
 								 const char *reason);
 
 /**
+ * Finds a user in a chat
+ *
+ * @param chat   The chat.
+ * @param user   The user to look for.
+ *
+ * @return TRUE if the user is in the chat, FALSE if not
+ */
+gboolean gaim_conv_chat_find_user(GaimConvChat *chat, const char *user);
+
+/**
+ * Set a users flags in a chat
+ *
+ * @param chat   The chat.
+ * @param user   The user to update.
+ * @param flags  The new flags.
+ */
+void gaim_conv_chat_user_set_flags(GaimConvChat *chat, const char *user,
+								   GaimConvChatBuddyFlags flags);
+
+/**
+ * Get the flags for a user in a chat
+ *
+ * @param chat   The chat.
+ * @param user   The user to find the flags for
+ *
+ * @return The flags for the user
+ */
+GaimConvChatBuddyFlags gaim_conv_chat_user_get_flags(GaimConvChat *chat,
+													 const char *user);
+
+/**
  * Clears all users from a chat.
  *
  * @param chat The chat.
@@ -1249,6 +1305,41 @@
  */
 gboolean gaim_conv_chat_has_left(GaimConvChat *chat);
 
+/**
+ * Creates a new chat buddy
+ *
+ * @param name The name.
+ * @param flags The flags.
+ *
+ * @return The new chat buddy
+ */
+GaimConvChatBuddy *gaim_conv_chat_cb_new(const char *name,
+										GaimConvChatBuddyFlags flags);
+
+/**
+ * Find a chat buddy in a chat
+ *
+ * @param chat The chat.
+ * @param name The name of the chat buddy to find.
+ */
+GaimConvChatBuddy *gaim_conv_chat_cb_find(GaimConvChat *chat, const char *name);
+
+/**
+ * Get the name of a chat buddy
+ *
+ * @param cb    The chat buddy.
+ *
+ * @return The name of the chat buddy.
+ */
+const char *gaim_conv_chat_cb_get_name(GaimConvChatBuddy *cb);
+
+/**
+ * Destroys a chat buddy
+ *
+ * @param cb The chat buddy to destroy
+ */
+void gaim_conv_chat_cb_destroy(GaimConvChatBuddy *cb);
+
 /*@}*/
 
 /**************************************************************************/