diff src/protocols/yahoo/yahoo.c @ 6513:63c449a1022f

[gaim-migrate @ 7030] Tim Ringenbach (marv_sf) writes: " This processes yahoo's weird color codes, and turns them into normal html. It also strips about fade, alt, and snd tags, while its at it. This doesn't make gaim send valid yahoo color codes, however. If you don't like some aspect of this patch, let me know and I'll fix it. Actually, I added a couple files, and cvs diff wouldn't cooperate, so I just tarred up the patch and the new files. Maybe I should have just stuck it all in yahoo.c. Oh well, you can make me redo it if you don't like it." someone test this and provide patches for any bugs. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 20 Aug 2003 01:17:26 +0000
parents fb64cc87bc96
children 64d952098596
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo.c	Wed Aug 20 01:10:32 2003 +0000
+++ b/src/protocols/yahoo/yahoo.c	Wed Aug 20 01:17:26 2003 +0000
@@ -33,6 +33,7 @@
 #include "util.h"
 #include "html.h"
 
+#include "yahoo.h"
 #include "md5.h"
 
 /* XXX */
@@ -564,24 +565,13 @@
 				tm = strtol(pair->value, NULL, 10);
 			if (pair->key == 14) {
 				char *m;
-				int i, j;
 
 				msg = pair->value;
 
 				strip_linefeed(msg);
-				m = msg;
-				for (i = 0, j = 0; m[i]; i++) {
-					if (m[i] == 033) {
-						while (m[i] && (m[i] != 'm'))
-							i++;
-						if (!m[i])
-							i--;
-						continue;
-					}
-					msg[j++] = m[i];
-				}
-				msg[j] = 0;
-				serv_got_im(gc, from, msg, 0, tm, -1);
+				m = yahoo_codes_to_html(msg);
+				serv_got_im(gc, from, m, 0, tm, -1);
+				g_free(m);
 
 				tm = time(NULL);
 			}
@@ -1393,6 +1383,12 @@
 	yahoo_packet_free(pkt);
 }
 
+static gboolean yahoo_unload_plugin(GaimPlugin *plugin)
+{
+	yahoo_dest_colorht();
+	return TRUE;
+}
+
 static GaimPlugin *my_protocol = NULL;
 
 static GaimPluginProtocolInfo prpl_info =
@@ -1469,7 +1465,7 @@
 	GAIM_WEBSITE,                                     /**< homepage       */
 
 	NULL,                                             /**< load           */
-	NULL,                                             /**< unload         */
+	yahoo_unload_plugin,                              /**< unload         */
 	NULL,                                             /**< destroy        */
 
 	NULL,                                             /**< ui_info        */
@@ -1492,6 +1488,8 @@
 											   option);
 
 	my_protocol = plugin;
+
+	yahoo_init_colorht();
 }
 
 GAIM_INIT_PLUGIN(yahoo, init_plugin, info);