libpurple/protocols/irc/cmds.c

branch
string-comparison-r2
changeset 38258
9a6551eba09c
parent 37954
b76dd48063d6
child 38259
c593fc9f5438
equal deleted inserted replaced
38257:1a294a6d2a57 38258:9a6551eba09c
277 char *buf; 277 char *buf;
278 278
279 if (!args) 279 if (!args)
280 return 0; 280 return 0;
281 281
282 if (!strcmp(cmd, "mode")) { 282 if (purple_strequal(cmd, "mode")) {
283 if (!args[0] && irc_ischannel(target)) 283 if (!args[0] && irc_ischannel(target))
284 buf = irc_format(irc, "vc", "MODE", target); 284 buf = irc_format(irc, "vc", "MODE", target);
285 else if (args[0] && (*args[0] == '+' || *args[0] == '-')) 285 else if (args[0] && (*args[0] == '+' || *args[0] == '-'))
286 buf = irc_format(irc, "vcn", "MODE", target, args[0]); 286 buf = irc_format(irc, "vcn", "MODE", target, args[0]);
287 else if (args[0]) 287 else if (args[0])
288 buf = irc_format(irc, "vn", "MODE", args[0]); 288 buf = irc_format(irc, "vn", "MODE", args[0]);
289 else 289 else
290 return 0; 290 return 0;
291 } else if (!strcmp(cmd, "umode")) { 291 } else if (purple_strequal(cmd, "umode")) {
292 if (!args[0]) 292 if (!args[0])
293 return 0; 293 return 0;
294 gc = purple_account_get_connection(irc->account); 294 gc = purple_account_get_connection(irc->account);
295 buf = irc_format(irc, "vnc", "MODE", purple_connection_get_display_name(gc), args[0]); 295 buf = irc_format(irc, "vnc", "MODE", purple_connection_get_display_name(gc), args[0]);
296 } else { 296 } else {
340 int i = 0, used = 0; 340 int i = 0, used = 0;
341 341
342 if (!args || !args[0] || !*args[0]) 342 if (!args || !args[0] || !*args[0])
343 return 0; 343 return 0;
344 344
345 if (!strcmp(cmd, "op")) { 345 if (purple_strequal(cmd, "op")) {
346 sign = "+"; 346 sign = "+";
347 mode = "o"; 347 mode = "o";
348 } else if (!strcmp(cmd, "deop")) { 348 } else if (purple_strequal(cmd, "deop")) {
349 sign = "-"; 349 sign = "-";
350 mode = "o"; 350 mode = "o";
351 } else if (!strcmp(cmd, "voice")) { 351 } else if (purple_strequal(cmd, "voice")) {
352 sign = "+"; 352 sign = "+";
353 mode = "v"; 353 mode = "v";
354 } else if (!strcmp(cmd, "devoice")) { 354 } else if (purple_strequal(cmd, "devoice")) {
355 sign = "-"; 355 sign = "-";
356 mode = "v"; 356 mode = "v";
357 } else { 357 } else {
358 purple_debug(PURPLE_DEBUG_ERROR, "irc", "invalid 'op' command '%s'\n", cmd); 358 purple_debug(PURPLE_DEBUG_ERROR, "irc", "invalid 'op' command '%s'\n", cmd);
359 return 0; 359 return 0;
447 g_utf8_validate(cur, max_privmsg_arg_len, &end); 447 g_utf8_validate(cur, max_privmsg_arg_len, &end);
448 } 448 }
449 449
450 msg = g_strndup(cur, end - cur); 450 msg = g_strndup(cur, end - cur);
451 451
452 if(!strcmp(cmd, "notice")) 452 if(purple_strequal(cmd, "notice"))
453 buf = irc_format(irc, "vt:", "NOTICE", args[0], msg); 453 buf = irc_format(irc, "vt:", "NOTICE", args[0], msg);
454 else 454 else
455 buf = irc_format(irc, "vt:", "PRIVMSG", args[0], msg); 455 buf = irc_format(irc, "vt:", "PRIVMSG", args[0], msg);
456 456
457 irc_send(irc, buf); 457 irc_send(irc, buf);
617 char *buf; 617 char *buf;
618 618
619 if (!args || !args[0]) 619 if (!args || !args[0])
620 return 0; 620 return 0;
621 621
622 if (!strcmp(cmd, "wallops")) 622 if (purple_strequal(cmd, "wallops"))
623 buf = irc_format(irc, "v:", "WALLOPS", args[0]); 623 buf = irc_format(irc, "v:", "WALLOPS", args[0]);
624 else if (!strcmp(cmd, "operwall")) 624 else if (purple_strequal(cmd, "operwall"))
625 buf = irc_format(irc, "v:", "OPERWALL", args[0]); 625 buf = irc_format(irc, "v:", "OPERWALL", args[0]);
626 else 626 else
627 return 0; 627 return 0;
628 628
629 irc_send(irc, buf); 629 irc_send(irc, buf);

mercurial