diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/nTox.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/testing/nTox.c b/testing/nTox.c index f87a2a25..de75d2ff 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -133,6 +133,9 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line) | |||
133 | } | 133 | } |
134 | else if (inpt_command == 'm') { //message command: /m friendnumber messsage | 134 | else if (inpt_command == 'm') { //message command: /m friendnumber messsage |
135 | size_t len = strlen(line); | 135 | size_t len = strlen(line); |
136 | if(len < 3) | ||
137 | return; | ||
138 | |||
136 | char numstring[len-3]; | 139 | char numstring[len-3]; |
137 | char message[len-3]; | 140 | char message[len-3]; |
138 | int i; | 141 | int i; |
@@ -141,13 +144,13 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line) | |||
141 | numstring[i] = line[i+3]; | 144 | numstring[i] = line[i+3]; |
142 | } else { | 145 | } else { |
143 | int j; | 146 | int j; |
144 | for (j = (i+1); j < len; j++) | 147 | for (j = (i+1); j < (len+1); j++) |
145 | message[j-i-1] = line[j+3]; | 148 | message[j-i-1] = line[j+3]; |
146 | break; | 149 | break; |
147 | } | 150 | } |
148 | } | 151 | } |
149 | int num = atoi(numstring); | 152 | int num = atoi(numstring); |
150 | if (m_sendmessage(num, (uint8_t*) message, sizeof(message)) != 1) { | 153 | if (m_sendmessage(num, (uint8_t*) message, strlen(message) + 1) != 1) { |
151 | new_lines("[i] could not send message"); | 154 | new_lines("[i] could not send message"); |
152 | } else { | 155 | } else { |
153 | new_lines(format_message(message, -1)); | 156 | new_lines(format_message(message, -1)); |
@@ -162,7 +165,7 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line) | |||
162 | name[i-3] = line[i]; | 165 | name[i-3] = line[i]; |
163 | } | 166 | } |
164 | name[i-3] = 0; | 167 | name[i-3] = 0; |
165 | setname(name, i); | 168 | setname(name, i - 2); |
166 | char numstring[100]; | 169 | char numstring[100]; |
167 | sprintf(numstring, "[i] changed nick to %s", (char*)name); | 170 | sprintf(numstring, "[i] changed nick to %s", (char*)name); |
168 | new_lines(numstring); | 171 | new_lines(numstring); |
@@ -179,7 +182,7 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line) | |||
179 | status[i-3] = line[i]; | 182 | status[i-3] = line[i]; |
180 | } | 183 | } |
181 | status[i-3] = 0; | 184 | status[i-3] = 0; |
182 | m_set_userstatus(status, strlen((char*)status)); | 185 | m_set_userstatus(status, strlen((char*)status) + 1); |
183 | char numstring[100]; | 186 | char numstring[100]; |
184 | sprintf(numstring, "[i] changed status to %s", (char*)status); | 187 | sprintf(numstring, "[i] changed status to %s", (char*)status); |
185 | new_lines(numstring); | 188 | new_lines(numstring); |