comparison 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
comparison
equal deleted inserted replaced
9553:8a64666476e6 9554:8b2451878e26
35 typedef struct _GaimConvWindow GaimConvWindow; 35 typedef struct _GaimConvWindow GaimConvWindow;
36 typedef struct _GaimConversationUiOps GaimConversationUiOps; 36 typedef struct _GaimConversationUiOps GaimConversationUiOps;
37 typedef struct _GaimConversation GaimConversation; 37 typedef struct _GaimConversation GaimConversation;
38 typedef struct _GaimConvIm GaimConvIm; 38 typedef struct _GaimConvIm GaimConvIm;
39 typedef struct _GaimConvChat GaimConvChat; 39 typedef struct _GaimConvChat GaimConvChat;
40 typedef struct _GaimConvChatBuddy GaimConvChatBuddy;
40 41
41 /** 42 /**
42 * A type of conversation. 43 * A type of conversation.
43 */ 44 */
44 typedef enum 45 typedef enum
116 GAIM_MESSAGE_NO_LOG = 0x0040, /**< Do not log. */ 117 GAIM_MESSAGE_NO_LOG = 0x0040, /**< Do not log. */
117 GAIM_MESSAGE_WHISPER = 0x0080, /**< Whispered message. */ 118 GAIM_MESSAGE_WHISPER = 0x0080, /**< Whispered message. */
118 GAIM_MESSAGE_ERROR = 0x0200 /**< Error message. */ 119 GAIM_MESSAGE_ERROR = 0x0200 /**< Error message. */
119 } GaimMessageFlags; 120 } GaimMessageFlags;
120 121
122 /**
123 * Flags applicable to users in Chats.
124 */
125 typedef enum
126 {
127 GAIM_CBFLAGS_NONE = 0x0000, /**< No flags */
128 GAIM_CBFLAGS_VOICE = 0x0001, /**< Voiced user or "Participant" */
129 GAIM_CBFLAGS_HALFOP = 0x0002, /**< Half-op */
130 GAIM_CBFLAGS_OP = 0x0004, /**< Channel Op or Moderator */
131 GAIM_CBFLAGS_FOUNDER = 0x0008 /**< Channel Founder */
132 } GaimConvChatBuddyFlags;
133
121 #include "account.h" 134 #include "account.h"
122 #include "log.h" 135 #include "log.h"
123 #include "buddyicon.h" 136 #include "buddyicon.h"
124 #include "server.h" 137 #include "server.h"
125 138
173 void (*chat_add_users)(GaimConversation *conv, GList *users); 186 void (*chat_add_users)(GaimConversation *conv, GList *users);
174 void (*chat_rename_user)(GaimConversation *conv, 187 void (*chat_rename_user)(GaimConversation *conv,
175 const char *old_name, const char *new_name); 188 const char *old_name, const char *new_name);
176 void (*chat_remove_user)(GaimConversation *conv, const char *user); 189 void (*chat_remove_user)(GaimConversation *conv, const char *user);
177 void (*chat_remove_users)(GaimConversation *conv, GList *users); 190 void (*chat_remove_users)(GaimConversation *conv, GList *users);
191 void (*chat_update_user)(GaimConversation *conv, const char *user);
178 192
179 void (*update_progress)(GaimConversation *conv, float percent); 193 void (*update_progress)(GaimConversation *conv, float percent);
180 194
181 gboolean (*has_focus)(GaimConversation *conv); 195 gboolean (*has_focus)(GaimConversation *conv);
182 196
229 243
230 gboolean left; /**< We left the chat and kept the window open */ 244 gboolean left; /**< We left the chat and kept the window open */
231 }; 245 };
232 246
233 /** 247 /**
248 * Data for "Chat Buddies"
249 */
250 struct _GaimConvChatBuddy
251 {
252 char *name; /**< The name */
253 GaimConvChatBuddyFlags flags; /**< Flags (ops, voice etc.) */
254 };
255
256 /**
234 * A core representation of a conversation between two or more people. 257 * A core representation of a conversation between two or more people.
235 * 258 *
236 * The conversation can be an IM or a chat. Each conversation is kept 259 * The conversation can be an IM or a chat. Each conversation is kept
237 * in a GaimConvWindow and has a UI representation. 260 * in a GaimConvWindow and has a UI representation.
238 */ 261 */
1148 * Adds a user to a chat. 1171 * Adds a user to a chat.
1149 * 1172 *
1150 * @param chat The chat. 1173 * @param chat The chat.
1151 * @param user The user to add. 1174 * @param user The user to add.
1152 * @param extra_msg An extra message to display with the join message. 1175 * @param extra_msg An extra message to display with the join message.
1176 * @param flags The users flags
1153 */ 1177 */
1154 void gaim_conv_chat_add_user(GaimConvChat *chat, const char *user, 1178 void gaim_conv_chat_add_user(GaimConvChat *chat, const char *user,
1155 const char *extra_msg); 1179 const char *extra_msg, GaimConvChatBuddyFlags flags);
1156 1180
1157 /** 1181 /**
1158 * Adds a list of users to a chat. 1182 * Adds a list of users to a chat.
1159 * 1183 *
1160 * The data is copied from @a users, so it is up to the developer to 1184 * The data is copied from @a users, so it is up to the developer to
1161 * free this list after calling this function. 1185 * free this list after calling this function.
1162 * 1186 *
1163 * @param chat The chat. 1187 * @param chat The chat.
1164 * @param users The list of users to add. 1188 * @param users The list of users to add.
1165 */ 1189 * @param flags The list of flags for each user.
1166 void gaim_conv_chat_add_users(GaimConvChat *chat, GList *users); 1190 */
1191 void gaim_conv_chat_add_users(GaimConvChat *chat, GList *users, GList *flags);
1167 1192
1168 /** 1193 /**
1169 * Renames a user in a chat. 1194 * Renames a user in a chat.
1170 * 1195 *
1171 * @param chat The chat. 1196 * @param chat The chat.
1196 */ 1221 */
1197 void gaim_conv_chat_remove_users(GaimConvChat *chat, GList *users, 1222 void gaim_conv_chat_remove_users(GaimConvChat *chat, GList *users,
1198 const char *reason); 1223 const char *reason);
1199 1224
1200 /** 1225 /**
1226 * Finds a user in a chat
1227 *
1228 * @param chat The chat.
1229 * @param user The user to look for.
1230 *
1231 * @return TRUE if the user is in the chat, FALSE if not
1232 */
1233 gboolean gaim_conv_chat_find_user(GaimConvChat *chat, const char *user);
1234
1235 /**
1236 * Set a users flags in a chat
1237 *
1238 * @param chat The chat.
1239 * @param user The user to update.
1240 * @param flags The new flags.
1241 */
1242 void gaim_conv_chat_user_set_flags(GaimConvChat *chat, const char *user,
1243 GaimConvChatBuddyFlags flags);
1244
1245 /**
1246 * Get the flags for a user in a chat
1247 *
1248 * @param chat The chat.
1249 * @param user The user to find the flags for
1250 *
1251 * @return The flags for the user
1252 */
1253 GaimConvChatBuddyFlags gaim_conv_chat_user_get_flags(GaimConvChat *chat,
1254 const char *user);
1255
1256 /**
1201 * Clears all users from a chat. 1257 * Clears all users from a chat.
1202 * 1258 *
1203 * @param chat The chat. 1259 * @param chat The chat.
1204 */ 1260 */
1205 void gaim_conv_chat_clear_users(GaimConvChat *chat); 1261 void gaim_conv_chat_clear_users(GaimConvChat *chat);
1246 * 1302 *
1247 * @return @c TRUE if we left the chat already, @c FALSE if 1303 * @return @c TRUE if we left the chat already, @c FALSE if
1248 * we're still there. 1304 * we're still there.
1249 */ 1305 */
1250 gboolean gaim_conv_chat_has_left(GaimConvChat *chat); 1306 gboolean gaim_conv_chat_has_left(GaimConvChat *chat);
1307
1308 /**
1309 * Creates a new chat buddy
1310 *
1311 * @param name The name.
1312 * @param flags The flags.
1313 *
1314 * @return The new chat buddy
1315 */
1316 GaimConvChatBuddy *gaim_conv_chat_cb_new(const char *name,
1317 GaimConvChatBuddyFlags flags);
1318
1319 /**
1320 * Find a chat buddy in a chat
1321 *
1322 * @param chat The chat.
1323 * @param name The name of the chat buddy to find.
1324 */
1325 GaimConvChatBuddy *gaim_conv_chat_cb_find(GaimConvChat *chat, const char *name);
1326
1327 /**
1328 * Get the name of a chat buddy
1329 *
1330 * @param cb The chat buddy.
1331 *
1332 * @return The name of the chat buddy.
1333 */
1334 const char *gaim_conv_chat_cb_get_name(GaimConvChatBuddy *cb);
1335
1336 /**
1337 * Destroys a chat buddy
1338 *
1339 * @param cb The chat buddy to destroy
1340 */
1341 void gaim_conv_chat_cb_destroy(GaimConvChatBuddy *cb);
1251 1342
1252 /*@}*/ 1343 /*@}*/
1253 1344
1254 /**************************************************************************/ 1345 /**************************************************************************/
1255 /** @name Conversation Placement API */ 1346 /** @name Conversation Placement API */