Remove static meify from yahoochat.c and replace use of it with

Fri, 29 Jun 2007 19:36:31 +0000

author
Will Thompson <resiak@pidgin.im>
date
Fri, 29 Jun 2007 19:36:31 +0000
changeset 18413
ae04f38e5b31
parent 18412
6873322c380f
child 18414
b08108fc6ffc
child 18418
d87d76c657a7
child 18431
f8fd5fdd91aa
child 18498
8a387a7ba405

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.

libpurple/protocols/yahoo/yahoochat.c file | annotate | diff | comparison | revisions
libpurple/util.h file | annotate | diff | comparison | revisions
--- 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);
 

mercurial