comparison mcabber/src/commands.c @ 446:9f4e9e9aaf08

Minor changes & cleanup See diff for details.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 25 Sep 2005 00:44:11 +0200
parents 5927c3bfba13
children 03bb57383cea
comparison
equal deleted inserted replaced
445:7bf6c0c6a714 446:9f4e9e9aaf08
455 } 455 }
456 456
457 static void do_add(char *arg) 457 static void do_add(char *arg)
458 { 458 {
459 char *id, *nick; 459 char *id, *nick;
460 if (!arg || (*arg == 0)) { 460 if (!arg || (!*arg)) {
461 scr_LogPrint(LPRINT_NORMAL, "Wrong usage"); 461 scr_LogPrint(LPRINT_NORMAL, "Wrong usage");
462 return; 462 return;
463 } 463 }
464 464
465 id = g_strdup(arg); 465 id = g_strdup(arg);
498 static void do_group(char *arg) 498 static void do_group(char *arg)
499 { 499 {
500 gpointer group; 500 gpointer group;
501 guint leave_windowbuddy; 501 guint leave_windowbuddy;
502 502
503 if (!arg || (*arg == 0)) { 503 if (!arg || (!*arg)) {
504 scr_LogPrint(LPRINT_NORMAL, "Missing parameter"); 504 scr_LogPrint(LPRINT_NORMAL, "Missing parameter");
505 return; 505 return;
506 } 506 }
507 507
508 if (!current_buddy) return; 508 if (!current_buddy) return;
574 574
575 scr_LogPrint(LPRINT_NORMAL, "Entered multi-line message mode."); 575 scr_LogPrint(LPRINT_NORMAL, "Entered multi-line message mode.");
576 scr_LogPrint(LPRINT_NORMAL, "Select a buddy and use \"/msay send\" " 576 scr_LogPrint(LPRINT_NORMAL, "Select a buddy and use \"/msay send\" "
577 "when your message is ready."); 577 "when your message is ready.");
578 return; 578 return;
579 } else if (*arg == 0) { 579 } else if (!*arg) {
580 scr_LogPrint(LPRINT_NORMAL, "Please read the manual before using " 580 scr_LogPrint(LPRINT_NORMAL, "Please read the manual before using "
581 "the /msay command."); 581 "the /msay command.");
582 scr_LogPrint(LPRINT_NORMAL, "(Use \"/msay begin\" to enter " 582 scr_LogPrint(LPRINT_NORMAL, "(Use \"/msay begin\" to enter "
583 "multi-line mode...)"); 583 "multi-line mode...)");
584 return; 584 return;
614 } 614 }
615 615
616 static void do_buffer(char *arg) 616 static void do_buffer(char *arg)
617 { 617 {
618 int search_dir = 0; 618 int search_dir = 0;
619
620 if (buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_GROUP) {
621 scr_LogPrint(LPRINT_NORMAL, "Groups have no buffer");
622 return;
623 }
619 624
620 if (!strcasecmp(arg, "top")) { 625 if (!strcasecmp(arg, "top")) {
621 scr_BufferTopBottom(-1); 626 scr_BufferTopBottom(-1);
622 } else if (!strcasecmp(arg, "bottom")) { 627 } else if (!strcasecmp(arg, "bottom")) {
623 scr_BufferTopBottom(1); 628 scr_BufferTopBottom(1);
626 } else if (!strncasecmp(arg, "search_backward", 15)) { 631 } else if (!strncasecmp(arg, "search_backward", 15)) {
627 arg += 15; 632 arg += 15;
628 if (*arg++ == ' ') 633 if (*arg++ == ' ')
629 search_dir = -1; 634 search_dir = -1;
630 else 635 else
631 scr_LogPrint(LPRINT_NORMAL, "Missing parameter"); 636 scr_LogPrint(LPRINT_NORMAL, "Wrong or missing parameter");
632 } else if (!strncasecmp(arg, "search_forward", 14)) { 637 } else if (!strncasecmp(arg, "search_forward", 14)) {
633 arg += 14; 638 arg += 14;
634 if (*arg++ == ' ') 639 if (*arg++ == ' ')
635 search_dir = 1; 640 search_dir = 1;
636 else 641 else
637 scr_LogPrint(LPRINT_NORMAL, "Missing parameter"); 642 scr_LogPrint(LPRINT_NORMAL, "Wrong or missing parameter");
638 } else 643 } else
639 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!"); 644 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!");
640 645
641 if (search_dir) { // It is a string search command 646 if (search_dir) { // It is a string search command
642 for ( ; *arg && *arg == ' ' ; arg++) 647 for ( ; *arg && *arg == ' ' ; arg++)
714 gpointer bud; 719 gpointer bud;
715 const char *jid, *group; 720 const char *jid, *group;
716 guint type; 721 guint type;
717 char *newname, *p; 722 char *newname, *p;
718 723
719 if (!arg || (*arg == 0)) { 724 if (!arg || (!*arg)) {
720 scr_LogPrint(LPRINT_NORMAL, "Missing parameter"); 725 scr_LogPrint(LPRINT_NORMAL, "Missing parameter");
721 return; 726 return;
722 } 727 }
723 728
724 if (!current_buddy) return; 729 if (!current_buddy) return;
894 899
895 static void do_disconnect(char *arg) 900 static void do_disconnect(char *arg)
896 { 901 {
897 jb_disconnect(); 902 jb_disconnect();
898 } 903 }
899