diff src/gtkutils.c @ 5943:a4f2aba0848d

[gaim-migrate @ 6384] This should fix corruption in the blist, accounts, and pounces when some protocol plugins cannot load. Some parts of gaim now use the new unique Plugin or Protocol Plugin IDs, while some still use the old protocol numbers. Accounts kind of used both, and when prpls were missing, it had trouble finding accounts. It would find the names, even without mapping the protocol numbers to IDs, and any duplicate accounts would get nuked. That would then affect pounce saving. Anyhow, long story short (well, it's already long, too late for that), this should fix all that mess. And introduce new mess, but hopefully temporary mess. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 23 Jun 2003 02:00:15 +0000
parents 390d32a6b130
children 0a2a32b1917c
line wrap: on
line diff
--- a/src/gtkutils.c	Sun Jun 22 17:08:52 2003 +0000
+++ b/src/gtkutils.c	Mon Jun 23 02:00:15 2003 +0000
@@ -809,3 +809,101 @@
 
 	return optmenu;
 }
+
+char *stylize(const gchar *text, int length)
+{
+	gchar *buf;
+	char *tmp = g_malloc(length);
+
+	buf = g_malloc(length);
+	g_snprintf(buf, length, "%s", text);
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) {
+		g_snprintf(tmp, length, "<B>%s</B>", buf);
+		strcpy(buf, tmp);
+	}
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) {
+		g_snprintf(tmp, length, "<I>%s</I>", buf);
+		strcpy(buf, tmp);
+	}
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) {
+		g_snprintf(tmp, length, "<U>%s</U>", buf);
+		strcpy(buf, tmp);
+	}
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) {
+		g_snprintf(tmp, length, "<S>%s</S>", buf);
+		strcpy(buf, tmp);
+	}
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font")) {
+		const char *fontface;
+
+		fontface = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
+
+		g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, buf);
+		strcpy(buf, tmp);
+	}
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) {
+		int fontsize = gaim_prefs_get_int("/gaim/gtk/conversations/font_size");
+
+		g_snprintf(tmp, length, "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf);
+		strcpy(buf, tmp);
+	}
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) {
+		GdkColor fgcolor;
+
+		gdk_color_parse(
+			gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
+			&fgcolor);
+
+		g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>",
+				   fgcolor.red/256, fgcolor.green/256, fgcolor.blue/256, buf);
+		strcpy(buf, tmp);
+	}
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) {
+		GdkColor bgcolor;
+
+		gdk_color_parse(
+			gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
+			&bgcolor);
+
+		g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>",
+				   bgcolor.red/256, bgcolor.green/256, bgcolor.blue/256, buf);
+		strcpy(buf, tmp);
+	}
+
+	g_free(tmp);
+	return buf;
+}
+
+void show_usage(int mode, const char *name)
+{
+	switch (mode) {
+	case 0:		/* full help text */
+		printf(_("Gaim %s\n"
+		       "Usage: %s [OPTION]...\n\n"
+		       "  -a, --acct          display account editor window\n"
+		       "  -w, --away[=MESG]   make away on signon (optional argument MESG specifies\n"
+		       "                      name of away message to use)\n"
+		       "  -l, --login[=NAME]  automatically login (optional argument NAME specifies\n"
+		       "                      account(s) to use, seperated by commas)\n"
+		       "  -n, --loginwin      don't automatically login; show login window\n"
+		       "  -u, --user=NAME     use account NAME\n"
+		       "  -f, --file=FILE     use FILE as config\n"
+		       "  -d, --debug         print debugging messages to stdout\n"
+		       "  -v, --version       display the current version and exit\n"
+		       "  -h, --help          display this help and exit\n"), VERSION, name);
+		break;
+	case 1:		/* short message */
+		printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name);
+		break;
+	}
+}
+
+