diff src/protocols/napster/napster.c @ 12216:4d3119205a33

[gaim-migrate @ 14518] Remove GaimConvImFlags and GaimConvChatFlags - use GaimMessageFlags everywhere instead. Add a new GAIM_MESSAGE_IMAGES flag, and set it when sending a message containing images. When sending a message, the core will now always send "html" to the prpls, just like it expects to receive html from the prpls for received messages. This will allow text prpls such as SILC to support IM images and differentiate them from user input. Previously gaim_unescape_html() was used before passing the message to the prpl, now the prpl does this itself if it needs it. I think I updated all the prpls correctly, but I'm not so sure about sametime. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Thu, 24 Nov 2005 20:47:46 +0000
parents cbebda5f019c
children 1b57012eec7b
line wrap: on
line diff
--- a/src/protocols/napster/napster.c	Thu Nov 24 20:38:24 2005 +0000
+++ b/src/protocols/napster/napster.c	Thu Nov 24 20:47:46 2005 +0000
@@ -126,17 +126,20 @@
 }
 
 /* 205 - MSG_CLIENT_PRIVMSG */
-static int nap_send_im(GaimConnection *gc, const char *who, const char *message, GaimConvImFlags flags)
+static int nap_send_im(GaimConnection *gc, const char *who, const char *message, GaimMessageFlags flags)
 {
+	char *tmp = gaim_unescape_html(message);
 
-	if ((strlen(message) < 2) || (message[0] != '/' ) || (message[1] == '/')) {
+	if ((strlen(tmp) < 2) || (tmp[0] != '/' ) || (tmp[1] == '/')) {
 		/* Actually send a chat message */
-		nap_write_packet(gc, 205, "%s %s", who, message);
+		nap_write_packet(gc, 205, "%s %s", who, tmp);
 	} else {
 		/* user typed an IRC-style command */
-		nap_do_irc_style(gc, message, who);
+		nap_do_irc_style(gc, tmp, who);
 	}
 
+	g_free(tmp);
+
 	return 1;
 }
 
@@ -220,21 +223,24 @@
 }
 
 /* 402 - MSG_CLIENT_PUBLIC */
-static int nap_chat_send(GaimConnection *gc, int id, const char *message)
+static int nap_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags)
 {
 	GaimConversation *c = gaim_find_chat(gc, id);
+	char *tmp = gaim_unescape_html(message);
 
 	if (!c)
 		return -EINVAL;
 
-	if ((strlen(message) < 2) || (message[0] != '/' ) || (message[1] == '/')) {
+	if ((strlen(tmp) < 2) || (tmp[0] != '/' ) || (tmp[1] == '/')) {
 		/* Actually send a chat message */
-		nap_write_packet(gc, 402, "%s %s", c->name, message);
+		nap_write_packet(gc, 402, "%s %s", c->name, tmp);
 	} else {
 		/* user typed an IRC-style command */
-		nap_do_irc_style(gc, message, c->name);
+		nap_do_irc_style(gc, tmp, c->name);
 	}
 
+	g_free(tmp);
+
 	return 0;
 }