From: <ro...@us...> - 2006-07-23 04:10:58
|
Revision: 16544 Author: roast Date: 2006-07-22 21:10:52 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16544&view=rev Log Message: ----------- made a non-destructive gaim_message_is_meify() that returns the same as gaim_message_meify(), but does not modify the message Modified Paths: -------------- branches/soc-2006-file-loggers/src/util.c branches/soc-2006-file-loggers/src/util.h Modified: branches/soc-2006-file-loggers/src/util.c =================================================================== --- branches/soc-2006-file-loggers/src/util.c 2006-07-23 03:47:07 UTC (rev 16543) +++ branches/soc-2006-file-loggers/src/util.c 2006-07-23 04:10:52 UTC (rev 16544) @@ -4183,7 +4183,7 @@ } } -gboolean gaim_message_meify(char *message, size_t len) +gboolean gaim_message_is_meify(char *message, size_t len) { char *c; gboolean inside_html = FALSE; @@ -4206,11 +4206,29 @@ } if(*c && !g_ascii_strncasecmp(c, "/me ", 4)) { - memmove(c, c+4, len-3); return TRUE; } return FALSE; +} + +gboolean gaim_message_meify(char *message, size_t len) +{ + size_t length; + gboolean is_action; + + if (len == -1) + length = strlen(message); + else + length = len; + + is_action = gaim_message_is_meify(message, length); + + if (is_action) { + memmove(message, message+4, length-3); + } + + return is_action; } char *gaim_text_strip_mnemonic(const char *in) Modified: branches/soc-2006-file-loggers/src/util.h =================================================================== --- branches/soc-2006-file-loggers/src/util.h 2006-07-23 03:47:07 UTC (rev 16543) +++ branches/soc-2006-file-loggers/src/util.h 2006-07-23 04:10:52 UTC (rev 16544) @@ -994,6 +994,16 @@ * @param message The message to check * @param len The message length, or -1 * + * @return TRUE if it starts with /me, otherwise FALSE + */ +gboolean gaim_message_is_meify(char *message, size_t len); + +/** + * Trims the leading "/me " off of the message if it's there. + * + * @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 */ gboolean gaim_message_meify(char *message, size_t len); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |