diff src/conversation.h @ 4469:d76095396a0e

[gaim-migrate @ 4744] Phase 2 of the conversation rewrite! Did you think I was done? Okay everybody, the prefs page was slightly redesigned. Not much, though. It needs an overhaul, and still, not everything works.. What we have now is: Conversations | |- IMs |- Chats `- Tabs But that's not the good part of this patch. Oh no, not close. You see, in Conversations, we now have a "Placement" drop-down box. Though this prefs page is ugly and will eventually be redesigned, this gives you the opportunity to set one of a number of different types of conversation placement options. The defaults are: - Last created window: Adds the new conversation to the last created window, like how things have been lately. - New window: Adds the new conversation to a brand new window, every time. Tabs are still there, so you can drag them between windows if you want to manually group them. - By group: This is my new favorite. This will put the new conversation in whatever window it finds first that has another member from that same group on your buddy list. If it doesn't find one, it creates a new window. If the person you IM'd or the person who IM'd you is not on your list, it gets put in a window with other people not on your list. These are the only ones implemented, but don't think you're limited to that. You see, we have new API functions for registering these Conversation Placement functions. All a plugin would need to do is to write a function, take into account OPT_CONVO_COMBINE (oh yeah, "Show IMs and chats in same tabbed window" works again), make sure the conversation is added _somewhere_, and then just register that function. If the plugin is loaded, the user can select it from the existing drop-down box. Cool, huh? Make sure to unregister the function when the plugin is unloaded. Have fun. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 30 Jan 2003 09:22:15 +0000
parents 6e37eb000b7a
children 62c1e5e656d0
line wrap: on
line diff
--- a/src/conversation.h	Thu Jan 30 05:33:24 2003 +0000
+++ b/src/conversation.h	Thu Jan 30 09:22:15 2003 +0000
@@ -224,6 +224,7 @@
 	void *ui_data;                           /**< UI-specific data.       */
 };
 
+typedef void (*gaim_conv_placement_fnc)(struct gaim_conversation *);
 
 /**************************************************************************/
 /** @name Conversation Window API                                         */
@@ -389,6 +390,24 @@
  */
 GList *gaim_get_windows(void);
 
+/**
+ * Returns the first window containing a conversation of the specified type.
+ *
+ * @param type The conversation type.
+ *
+ * @return The window if found, or @c NULL if not found.
+ */
+struct gaim_window *gaim_get_first_window_with_type(GaimConversationType type);
+
+/**
+ * Returns the last window containing a conversation of the specified type.
+ *
+ * @param type The conversation type.
+ *
+ * @return The window if found, or @c NULL if not found.
+ */
+struct gaim_window *gaim_get_last_window_with_type(GaimConversationType type);
+
 /*@}*/
 
 /**************************************************************************/
@@ -472,17 +491,6 @@
 struct aim_user *gaim_conversation_get_user(
 		const struct gaim_conversation *conv);
 
-#if 0
-/**
- * Sets the specified conversation's gaim_connection.
- *
- * @param conv The conversation.
- * @param gc   The gaim_connection.
- */
-void gaim_conversation_set_gc(struct gaim_conversation *conv,
-							  struct gaim_connection *gc);
-#endif
-
 /**
  * Returns the specified conversation's gaim_connection.
  *
@@ -1064,4 +1072,78 @@
 
 /*@}*/
 
+/**************************************************************************/
+/** @name Conversation Placement Functions                                */
+/**************************************************************************/
+
+/**
+ * Adds a conversation placement function to the list of possible functions.
+ *
+ * @param name The name of the function.
+ * @param fnc  A pointer to the function.
+ *
+ * @return The index of this entry.
+ */
+int gaim_conv_placement_add_fnc(const char *name, gaim_conv_placement_fnc fnc);
+
+/**
+ * Removes a conversation placement function from the list of possible
+ * functions.
+ *
+ * @param index The index of the function.
+ */
+void gaim_conv_placement_remove_fnc(int index);
+
+/**
+ * Returns the number of conversation placement functions.
+ *
+ * @return The number of registered functions.
+ */
+int gaim_conv_placement_get_fnc_count(void);
+
+/**
+ * Returns the name of the conversation placement function at the
+ * specified index.
+ *
+ * @param index The index.
+ *
+ * @return The name of the function, or @c NULL if this index is out of
+ *         range.
+ */
+const char *gaim_conv_placement_get_name(int index);
+
+/**
+ * Returns a pointer to the conversation placement function at the
+ * specified index.
+ *
+ * @param index The index.
+ *
+ * @return A pointer to the function.
+ */
+gaim_conv_placement_fnc gaim_conv_placement_get_fnc(int index);
+
+/**
+ * Returns the index of the specified conversation placement function.
+ *
+ * @param fnc A pointer to the registered function.
+ *
+ * @return The index of the conversation, or -1 if the function is not
+ *         registered.
+ */
+int gaim_conv_placement_get_fnc_index(gaim_conv_placement_fnc fnc);
+
+/**
+ * Returns the index of the active conversation placement function.
+ *
+ * @param index The index of the active function.
+ */
+int gaim_conv_placement_get_active(void);
+
+/**
+ * Sets the active conversation placement function.
+ *
+ * @param index The index of the function.
+ */
+void gaim_conv_placement_set_active(int index);
+
 #endif /* _CONVERSATION_H_ */