changeset 18363:700b642631bc

Remove static meify from yahoochat.c and replace use of it with purple_message_meify, to which it was identical. Clarify the documentation of the latter slightly.
author Will Thompson <will.thompson@collabora.co.uk>
date Fri, 29 Jun 2007 19:36:31 +0000
parents 2177a11e169d
children 6e07a5da756e 1cd1e00e059c 7072971dfc44 7e0379a41a44
files libpurple/protocols/yahoo/yahoochat.c libpurple/util.h
diffstat 2 files changed, 4 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoochat.c	Fri Jun 29 15:30:22 2007 +0000
+++ b/libpurple/protocols/yahoo/yahoochat.c	Fri Jun 29 19:36:31 2007 +0000
@@ -785,44 +785,6 @@
 	g_free(eroom);
 }
 
-/* borrowed from gtkconv.c */
-static gboolean
-meify(char *message, size_t len)
-{
-	/*
-	 * Read /me-ify: If the message (post-HTML) starts with /me,
-	 * remove the "/me " part of it (including that space) and return TRUE.
-	 */
-	char *c;
-	gboolean inside_html = 0;
-
-	/* Umm.. this would be very bad if this happens. */
-	g_return_val_if_fail(message != NULL, FALSE);
-
-	if (len == -1)
-		len = strlen(message);
-
-	for (c = message; *c != '\0'; c++, len--) {
-		if (inside_html) {
-			if (*c == '>')
-				inside_html = FALSE;
-		}
-		else {
-			if (*c == '<')
-				inside_html = TRUE;
-			else
-				break;
-		}
-	}
-
-	if (*c != '\0' && !g_ascii_strncasecmp(c, "/me ", 4)) {
-		memmove(c, c + 4, len - 3);
-		return TRUE;
-	}
-
-	return FALSE;
-}
-
 static int yahoo_chat_send(PurpleConnection *gc, const char *dn, const char *room, const char *what, PurpleMessageFlags flags)
 {
 	struct yahoo_data *yd = gc->proto_data;
@@ -839,7 +801,7 @@
 
 	msg1 = g_strdup(what);
 
-	if (meify(msg1, -1))
+	if (purple_message_meify(msg1, -1))
 		me = 1;
 
 	msg2 = yahoo_html_to_codes(msg1);
--- a/libpurple/util.h	Fri Jun 29 15:30:22 2007 +0000
+++ b/libpurple/util.h	Fri Jun 29 19:36:31 2007 +0000
@@ -1105,12 +1105,13 @@
 void purple_print_utf8_to_console(FILE *filestream, char *message);
 
 /**
- * Checks for messages starting with "/me "
+ * Checks for messages starting (post-HTML) with "/me ", including the space.
  *
  * @param message The message to check
  * @param len     The message length, or -1
  *
- * @return TRUE if it starts with /me, and it has been removed, otherwise FALSE
+ * @return TRUE if it starts with "/me ", and it has been removed, otherwise
+ *         FALSE
  */
 gboolean purple_message_meify(char *message, size_t len);