changeset 10665:4829abdc5c35

[gaim-migrate @ 12205] and to oldstatus committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 07 Mar 2005 18:36:34 +0000
parents 7244386075c6
children b39d5850883a
files src/connection.h src/conversation.c src/conversation.h src/gtkconv.c
diffstat 4 files changed, 82 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/connection.h	Mon Mar 07 18:19:00 2005 +0000
+++ b/src/connection.h	Mon Mar 07 18:36:34 2005 +0000
@@ -41,7 +41,8 @@
 	GAIM_CONNECTION_FORMATTING_WBFO = 0x0008, /**< The text buffer must be formatted as a whole */
 	GAIM_CONNECTION_NO_NEWLINES = 0x0010, /**< No new lines are allowed in outgoing messages */
 	GAIM_CONNECTION_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */
-	GAIM_CONNECTION_NO_URLDESC = 0x0040  /**< Connection does not support descriptions with links */
+	GAIM_CONNECTION_NO_URLDESC = 0x0040,  /**< Connection does not support descriptions with links */ 
+	GAIM_CONNECTION_NO_IMAGES = 0x0080,  /**< Connection does not support sending of images */
 
 } GaimConnectionFlags;
 
--- a/src/conversation.c	Mon Mar 07 18:19:00 2005 +0000
+++ b/src/conversation.c	Mon Mar 07 18:36:34 2005 +0000
@@ -138,7 +138,7 @@
 	type = gaim_conversation_get_type(conv);
 	ops  = gaim_conversation_get_ui_ops(conv);
 
-	if (gc->flags & GAIM_CONNECTION_HTML)
+	if (conv->features & GAIM_CONNECTION_HTML)
 		displayed = gaim_markup_linkify(message);
 	else
 		displayed = g_strdup(message);
@@ -188,7 +188,7 @@
 		if (sent != NULL && sent[0] != '\0') {
 			GaimMessageFlags msgflags = GAIM_MESSAGE_SEND;
 
-			if (gc && gc->flags & GAIM_CONNECTION_HTML) {
+			if (conv->features & GAIM_CONNECTION_HTML) {
 				err = serv_send_im(gc, gaim_conversation_get_name(conv),
 				                   sent, 0);
 			} else {
@@ -212,7 +212,7 @@
 						 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)));
 
 		if (sent != NULL && sent[0] != '\0') {
-			if (gc && gc->flags & GAIM_CONNECTION_HTML) {
+			if (conv->features & GAIM_CONNECTION_HTML) {
 				err = serv_chat_send(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), sent);
 			} else {
 				gchar *tmp = gaim_unescape_html(sent);
@@ -748,6 +748,7 @@
 					  const char *name)
 {
 	GaimConversation *conv;
+	GaimConnection *gc;
 
 	g_return_val_if_fail(type    != GAIM_CONV_UNKNOWN, NULL);
 	g_return_val_if_fail(account != NULL, NULL);
@@ -766,6 +767,9 @@
 		}
 	}
 
+	gc = gaim_account_get_connection(account);
+	g_return_val_if_fail(gc != NULL, NULL);
+
 	conv = g_new0(GaimConversation, 1);
 
 	conv->type         = type;
@@ -779,7 +783,9 @@
 	conv->log          = gaim_log_new(type == GAIM_CONV_CHAT ? GAIM_LOG_CHAT :
 									  GAIM_LOG_IM, conv->name, account,
 									  time(NULL));
-
+	/* copy features from the connection. */
+	conv->features = gc->flags;
+	
 
 	if (type == GAIM_CONV_IM)
 	{
@@ -1025,6 +1031,30 @@
 	conv = NULL;
 }
 
+
+void
+gaim_conversation_set_features(GaimConversation *conv, GaimConnectionFlags features)
+{
+	GaimConversationUiOps *ops;
+
+	g_return_if_fail(conv != NULL);
+
+	conv->features = features;
+
+	ops = conv->ui_ops;
+	if(ops && ops->updated)
+		ops->updated(conv, GAIM_CONV_UPDATE_FEATURES);	
+}
+
+
+GaimConnectionFlags
+gaim_conversation_get_features(GaimConversation *conv)
+{
+	g_return_val_if_fail(conv != NULL, 0);
+	return conv->features;
+}
+
+
 GaimConversationType
 gaim_conversation_get_type(const GaimConversation *conv)
 {
--- a/src/conversation.h	Mon Mar 07 18:19:00 2005 +0000
+++ b/src/conversation.h	Mon Mar 07 18:36:34 2005 +0000
@@ -79,7 +79,6 @@
 	GAIM_CONV_UPDATE_LOGGING, /**< Logging for this conversation was
 	                               enabled or disabled. */
 	GAIM_CONV_UPDATE_TOPIC,   /**< The topic for a chat was updated. */
-
 	/*
 	 * XXX These need to go when we implement a more generic core/UI event
 	 * system.
@@ -89,7 +88,9 @@
 	GAIM_CONV_UPDATE_AWAY,     /**< The other user went away.                */
 	GAIM_CONV_UPDATE_ICON,     /**< The other user's buddy icon changed.     */
 	GAIM_CONV_UPDATE_TITLE,
-	GAIM_CONV_UPDATE_CHATLEFT
+	GAIM_CONV_UPDATE_CHATLEFT,
+
+	GAIM_CONV_UPDATE_FEATURES, /**< The features for a chat have changed */
 
 } GaimConvUpdateType;
 
@@ -132,7 +133,9 @@
 	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              */
+	GAIM_CBFLAGS_FOUNDER       = 0x0008, /**< Channel Founder              */
+	GAIM_CBFLAGS_TYPING        = 0x0010, /**< Currently typing             */
+	
 
 } GaimConvChatBuddyFlags;
 
@@ -164,6 +167,7 @@
 	void (*remove_conversation)(GaimConvWindow *win, GaimConversation *conv);
 	void (*move_conversation)(GaimConvWindow *win, GaimConversation *conv,
 	                          unsigned int newIndex);
+
 	int (*get_active_index)(const GaimConvWindow *win);
 	gboolean (*has_focus)(GaimConvWindow *win);
 };
@@ -305,6 +309,9 @@
 	void *ui_data;                           /**< UI-specific data.       */
 
 	GHashTable *data;                        /**< Plugin-specific data.   */
+  
+	GaimConnectionFlags features; /**< The supported features */
+
 };
 
 typedef void (*GaimConvPlacementFunc)(GaimConversation *);
@@ -495,7 +502,6 @@
  * @return The window if found, or @c NULL if not found.
  */
 GaimConvWindow *gaim_get_first_window_with_type(GaimConversationType type);
-
 /**
  * Returns the last window containing a conversation of the specified type.
  *
@@ -839,8 +845,25 @@
  * @see gaim_conv_chat_write()
  */
 void gaim_conversation_write(GaimConversation *conv, const char *who,
-							 const char *message, GaimMessageFlags flags,
-							 time_t mtime);
+		const char *message, GaimMessageFlags flags,
+		time_t mtime);
+
+
+/**
+	Set the features as supported for the given conversation.
+	@param conv      The conversation
+	@param features  Bitset defining supported features
+*/
+void gaim_conversation_set_features(GaimConversation *conv,
+		GaimConnectionFlags features);
+
+
+/**
+	Get the features supported by the given conversation.
+	@param conv  The conversation
+*/
+GaimConnectionFlags gaim_conversation_get_features(GaimConversation *conv);		    
+
 
 /**
  * Updates the progress bar on a conversation window
@@ -1522,6 +1545,7 @@
  */
 GaimConvWindowUiOps *gaim_conversations_get_win_ui_ops(void);
 
+
 /*@}*/
 
 /**************************************************************************/
--- a/src/gtkconv.c	Mon Mar 07 18:19:00 2005 +0000
+++ b/src/gtkconv.c	Mon Mar 07 18:36:34 2005 +0000
@@ -199,9 +199,8 @@
 default_formatize(GaimConversation *conv)
 {
 	GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv);
-	GaimConnection *gc = gaim_conversation_get_gc(conv);
-
-	if (gc && gc->flags & GAIM_CONNECTION_HTML)
+
+	if (conv->features & GAIM_CONNECTION_HTML)
 	{
 		if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting"))
 		{
@@ -220,7 +219,7 @@
 			gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry),
 				gaim_prefs_get_string("/gaim/gtk/conversations/font_face"));
 
-			if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE))
+			if (!(conv->features & GAIM_CONNECTION_NO_FONTSIZE))
 				gtk_imhtml_font_set_size(GTK_IMHTML(c->entry),
 					gaim_prefs_get_int("/gaim/gtk/conversations/font_size"));
 
@@ -239,7 +238,7 @@
 			gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color);
 			g_free(color);
 
-			if(!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) &&
+			if(!(conv->features & GAIM_CONNECTION_NO_BGCOLOR) &&
 			   strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0)
 			{
 				gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
@@ -257,7 +256,7 @@
 		}
 
 
-		if (gc->flags & GAIM_CONNECTION_FORMATTING_WBFO)
+		if (conv->features & GAIM_CONNECTION_FORMATTING_WBFO)
 			gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE);
 		else
 			gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE);
@@ -486,7 +485,7 @@
 	}
 
 	gc = gaim_account_get_connection(account);
-	if (gc && (gc->flags & GAIM_CONNECTION_NO_NEWLINES)) {
+	if (gc && (conv->features & GAIM_CONNECTION_NO_NEWLINES)) {
 		char **bufs;
 		int i;
 
@@ -2633,6 +2632,7 @@
  * End of the bunch of buddy icon functions
  **************************************************************************/
 
+
 /*
  * Makes sure all the menu items and all the buttons are hidden/shown and
  * sensitive/insensitive.  This is called after changing tabs and when an
@@ -2731,17 +2731,17 @@
 	    !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) {
 		/* Account is online */
 		/* Deal with the toolbar */
-		if (gc->flags & GAIM_CONNECTION_HTML) {
+		if (conv->features & GAIM_CONNECTION_HTML) {
 			buttons = GTK_IMHTML_ALL;    /* Everything on */
 			if (!(prpl_info->options & OPT_PROTO_IM_IMAGE))
 				buttons &= ~GTK_IMHTML_IMAGE;
-			if (gc->flags & GAIM_CONNECTION_NO_BGCOLOR)
+			if (conv->features & GAIM_CONNECTION_NO_BGCOLOR)
 				buttons &= ~GTK_IMHTML_BACKCOLOR;
-			if (gc->flags & GAIM_CONNECTION_NO_FONTSIZE) {
+			if (conv->features & GAIM_CONNECTION_NO_FONTSIZE) {
 				buttons &= ~GTK_IMHTML_GROW;
 				buttons &= ~GTK_IMHTML_SHRINK;
 			}
-			if (gc->flags & GAIM_CONNECTION_NO_URLDESC)
+			if (conv->features & GAIM_CONNECTION_NO_URLDESC)
 				buttons &= ~GTK_IMHTML_LINKDESC;
 		} else {
 			buttons = GTK_IMHTML_SMILEY;
@@ -2756,7 +2756,7 @@
 		gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL));
 		gtk_widget_set_sensitive(gtkwin->menu.invite, (prpl_info->chat_invite != NULL));
 		gtk_widget_set_sensitive(gtkwin->menu.block, (prpl_info->add_deny != NULL));
-		gtk_widget_set_sensitive(gtkwin->menu.insert_link, (gc->flags & GAIM_CONNECTION_HTML));
+		gtk_widget_set_sensitive(gtkwin->menu.insert_link, (conv->features & GAIM_CONNECTION_HTML));
 		gtk_widget_set_sensitive(gtkwin->menu.insert_image, (prpl_info->options & OPT_PROTO_IM_IMAGE));
 
 		if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
@@ -5410,6 +5410,10 @@
 	{
 		gaim_gtkconv_update_buddy_icon(conv);
 	}
+	else if (type == GAIM_CONV_UPDATE_FEATURES)
+	{
+		gray_stuff_out(conv);
+	}
 }
 
 static GaimConversationUiOps conversation_ui_ops =