changeset 1370:776bb4c6c0b8

[gaim-migrate @ 1380] woohoo. no more HTML codes in protocols that don't support them. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 04 Jan 2001 21:59:35 +0000
parents 0b4278a90323
children 1136f7896eeb
files src/conversation.c src/oscar.c src/prefs.c src/prpl.h src/toc.c
diffstat 5 files changed, 56 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Wed Jan 03 04:36:03 2001 +0000
+++ b/src/conversation.c	Thu Jan 04 21:59:35 2001 +0000
@@ -623,41 +623,43 @@
 
 	buf2 = g_malloc(limit);
 
-	if (font_options & OPT_FONT_BOLD) {
-		g_snprintf(buf2, limit, "<B>%s</B>", buf);
-		strcpy(buf, buf2);
-	}
+	if (c->gc->prpl->options & OPT_PROTO_HTML) {
+		if (font_options & OPT_FONT_BOLD) {
+			g_snprintf(buf2, limit, "<B>%s</B>", buf);
+			strcpy(buf, buf2);
+		}
 
-	if (font_options & OPT_FONT_ITALIC) {
-		g_snprintf(buf2, limit, "<I>%s</I>", buf);
-		strcpy(buf, buf2);
-	}
+		if (font_options & OPT_FONT_ITALIC) {
+			g_snprintf(buf2, limit, "<I>%s</I>", buf);
+			strcpy(buf, buf2);
+		}
 
-	if (font_options & OPT_FONT_UNDERLINE) {
-		g_snprintf(buf2, limit, "<U>%s</U>", buf);
-		strcpy(buf, buf2);
-	}
+		if (font_options & OPT_FONT_UNDERLINE) {
+			g_snprintf(buf2, limit, "<U>%s</U>", buf);
+			strcpy(buf, buf2);
+		}
 
-	if (font_options & OPT_FONT_STRIKE) {
-		g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf);
-		strcpy(buf, buf2);
-	}
+		if (font_options & OPT_FONT_STRIKE) {
+			g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf);
+			strcpy(buf, buf2);
+		}
 
-	if ((font_options & OPT_FONT_FACE) || c->hasfont) {
-		g_snprintf(buf2, limit, "<FONT FACE=\"%s\">%s</FONT>", c->fontface, buf);
-		strcpy(buf, buf2);
-	}
+		if ((font_options & OPT_FONT_FACE) || c->hasfont) {
+			g_snprintf(buf2, limit, "<FONT FACE=\"%s\">%s</FONT>", c->fontface, buf);
+			strcpy(buf, buf2);
+		}
 
-	if ((font_options & OPT_FONT_FGCOL) || c->hasfg) {
-		g_snprintf(buf2, limit, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", c->fgcol.red,
-			   c->fgcol.green, c->fgcol.blue, buf);
-		strcpy(buf, buf2);
-	}
+		if ((font_options & OPT_FONT_FGCOL) || c->hasfg) {
+			g_snprintf(buf2, limit, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", c->fgcol.red,
+				   c->fgcol.green, c->fgcol.blue, buf);
+			strcpy(buf, buf2);
+		}
 
-	if ((font_options & OPT_FONT_BGCOL) || c->hasbg) {
-		g_snprintf(buf2, limit, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", c->bgcol.red,
-			   c->bgcol.green, c->bgcol.blue, buf);
-		strcpy(buf, buf2);
+		if ((font_options & OPT_FONT_BGCOL) || c->hasbg) {
+			g_snprintf(buf2, limit, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", c->bgcol.red,
+				   c->bgcol.green, c->bgcol.blue, buf);
+			strcpy(buf, buf2);
+		}
 	}
 
 	{
--- a/src/oscar.c	Wed Jan 03 04:36:03 2001 +0000
+++ b/src/oscar.c	Thu Jan 04 21:59:35 2001 +0000
@@ -2258,6 +2258,7 @@
 
 void oscar_init(struct prpl *ret) {
 	ret->protocol = PROTO_OSCAR;
+	ret->options = OPT_PROTO_HTML;
 	ret->name = oscar_name;
 	ret->list_icon = oscar_list_icon;
 	ret->action_menu = oscar_action_menu;
--- a/src/prefs.c	Wed Jan 03 04:36:03 2001 +0000
+++ b/src/prefs.c	Thu Jan 04 21:59:35 2001 +0000
@@ -1116,6 +1116,7 @@
 static struct away_message *cur_message;
 static char *edited_message;
 static GtkWidget *away_text;
+static GtkWidget *make_away_button = NULL;;
 
 void away_list_clicked(GtkWidget *widget, struct away_message *a)
 {
@@ -1166,6 +1167,7 @@
 {
 	gtk_widget_destroy(prefs_away_list);
 	prefs_away_list = NULL;
+	make_away_button = NULL;
 }
 
 static void do_away_mess(GtkWidget *m, gpointer n)
@@ -1302,9 +1304,11 @@
 	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), button);
 	gtk_box_pack_start(GTK_BOX(bot), button, TRUE, FALSE, 5);
 
-	button = picture_button(prefs, _("Make Away"), gnome_preferences_xpm);
-	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_away_mess), NULL);
-	gtk_box_pack_start(GTK_BOX(bot), button, TRUE, FALSE, 5);
+	make_away_button = picture_button(prefs, _("Make Away"), gnome_preferences_xpm);
+	gtk_signal_connect(GTK_OBJECT(make_away_button), "clicked", GTK_SIGNAL_FUNC(do_away_mess), NULL);
+	gtk_box_pack_start(GTK_BOX(bot), make_away_button, TRUE, FALSE, 5);
+	if (!connections)
+		gtk_widget_set_sensitive(make_away_button, FALSE);
 
 	button = picture_button(prefs, _("Remove"), gnome_remove_xpm);
 	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(remove_away_message), NULL);
@@ -1449,7 +1453,6 @@
 
 	parent = prefdialog->parent;
 	gtk_widget_destroy(prefdialog);
-	prefs_away_list = NULL;
 
 	prefdialog = gtk_frame_new(_("Browser Options"));
 	gtk_container_add(GTK_CONTAINER(parent), prefdialog);
@@ -1801,8 +1804,8 @@
 	gtk_widget_show(prefdialog);
 }
 
-void update_connection_dependent_prefs()
-{				/* what a crappy name */
+void update_connection_dependent_prefs()	/* what a crappy name */
+{
 	gboolean needdeny = FALSE;
 	GSList *c = connections;
 	struct gaim_connection *gc = NULL;
@@ -1831,6 +1834,13 @@
 	} else if (needdeny && !deny_node) {
 		prefs_build_deny();
 	}
+
+	if (make_away_button) {
+		if (connections)
+			gtk_widget_set_sensitive(make_away_button, TRUE);
+		else
+			gtk_widget_set_sensitive(make_away_button, FALSE);
+	}
 }
 
 static void try_me(GtkCTree * ctree, GtkCTreeNode * node)
--- a/src/prpl.h	Wed Jan 03 04:36:03 2001 +0000
+++ b/src/prpl.h	Thu Jan 04 21:59:35 2001 +0000
@@ -35,10 +35,16 @@
 #define PROTO_JABBER	8
 #define PROTO_NAPSTER	9
 
+#define OPT_PROTO_HTML  0x00000001
+/* there should be more here eventually... These should all be stuff that other
+ * plugins can't do (for example, TOC and Oscar and Jabber can do HTML in messages,
+ * but IRC etc can't, so TOC/Oscar/Jabber have _HTML set but not IRC. */
+
 typedef void (*proto_init)(struct prpl *);
 
 struct prpl {
 	int protocol;
+	int options;
 	char *(* name)();
 
 	/* returns the XPM associated with the given user class */
--- a/src/toc.c	Wed Jan 03 04:36:03 2001 +0000
+++ b/src/toc.c	Thu Jan 04 21:59:35 2001 +0000
@@ -46,7 +46,7 @@
 #include "pixmaps/dt_icon.xpm"
 #include "pixmaps/free_icon.xpm"
 
-#define REVISION "gaim:$Revision: 1378 $"
+#define REVISION "gaim:$Revision: 1380 $"
 
 #define TYPE_SIGNON    1
 #define TYPE_DATA      2
@@ -1173,6 +1173,7 @@
 void toc_init(struct prpl *ret)
 {
 	ret->protocol = PROTO_TOC;
+	ret->options = OPT_PROTO_HTML;
 	ret->name = toc_name;
 	ret->list_icon = toc_list_icon;
 	ret->action_menu = toc_action_menu;