diff src/cmds.c @ 9428:796f510a6e19

[gaim-migrate @ 10247] Arun A Tharuvai writes: Slash commands with "w" (and "W") ignore space between it and the next command. This causes the trailing space to either: get treated as the first character of of an immediately following "s" (or "S") argument, or get treated as the entire contents of any following "w" (or "W") arguments. This patch of his, #982083, fixes those issues. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Tue, 29 Jun 2004 21:34:07 +0000
parents 5f6ba17ef9f5
children d6f398e80b32
line wrap: on
line diff
--- a/src/cmds.c	Tue Jun 29 20:35:30 2004 +0000
+++ b/src/cmds.c	Tue Jun 29 21:34:07 2004 +0000
@@ -120,15 +120,25 @@
 
 		switch (cmd->args[i]) {
 		case 'w':
-			if (!(end = strchr(cur, ' '))) end = cur + strlen(cur);
-			(*args)[i] = g_strndup(cur, end - cur);
-			cur += end - cur;
+			if (!(end = strchr(cur, ' '))) {
+			  end = cur + strlen(cur);
+			  (*args)[i] = g_strndup(cur, end - cur);
+			  cur = end;
+			} else {
+			  (*args)[i] = g_strndup(cur, end - cur);
+			  cur = end + 1;
+			}
 			break;
 		case 'W':
-			if (!(end = strchr(cur, ' '))) end = cur + strlen(cur);
-			(*args)[i] = gaim_markup_slice(m, g_utf8_pointer_to_offset(s, cur), g_utf8_pointer_to_offset(s, end));
-			cur += end - cur;
-			break;
+		        if (!(end = strchr(cur, ' '))) {
+			  end = cur + strlen(cur);
+			  (*args)[i] = gaim_markup_slice(m, g_utf8_pointer_to_offset(s, cur), g_utf8_pointer_to_offset(s, end));
+			  cur = end;
+			} else {
+			  (*args)[i] = gaim_markup_slice(m, g_utf8_pointer_to_offset(s, cur), g_utf8_pointer_to_offset(s, end));
+			  cur = end +1;
+			}
+			break; 
 		case 's':
 			(*args)[i] = g_strdup(cur);
 			cur = cur + strlen(cur);