comparison mcabber/src/commands.c @ 1415:317f8d181626

Rename command public functions Add a prefix ("cmd_").
author Mikael Berthe <mikael@lilotux.net>
date Sat, 19 Jan 2008 16:42:34 +0100
parents 366ef500c522
children 7f0da8de2a7d
comparison
equal deleted inserted replaced
1414:366ef500c522 1415:317f8d181626
781 } else 781 } else
782 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!"); 782 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!");
783 free_arg_lst(paramlst); 783 free_arg_lst(paramlst);
784 } 784 }
785 785
786 // setstatus(recipient, arg) 786 // cmd_setstatus(recipient, arg)
787 // Set your Jabber status. 787 // Set your Jabber status.
788 // - if recipient is not NULL, the status is sent to this contact only 788 // - if recipient is not NULL, the status is sent to this contact only
789 // - arg must be "status message" (message is optional) 789 // - arg must be "status message" (message is optional)
790 void setstatus(const char *recipient, const char *arg) 790 void cmd_setstatus(const char *recipient, const char *arg)
791 { 791 {
792 char **paramlst; 792 char **paramlst;
793 char *status; 793 char *status;
794 char *msg; 794 char *msg;
795 enum imstatus st; 795 enum imstatus st;
844 imstatus2char[jb_getstatus()], 844 imstatus2char[jb_getstatus()],
845 (sm ? sm : "")); 845 (sm ? sm : ""));
846 return; 846 return;
847 } 847 }
848 arg = to_utf8(arg); 848 arg = to_utf8(arg);
849 setstatus(NULL, arg); 849 cmd_setstatus(NULL, arg);
850 g_free(arg); 850 g_free(arg);
851 } 851 }
852 852
853 static void do_status_to(char *arg) 853 static void do_status_to(char *arg)
854 { 854 {
898 if (!msg) 898 if (!msg)
899 msg = ""; 899 msg = "";
900 msg = to_utf8(msg); 900 msg = to_utf8(msg);
901 cmdline = g_strdup_printf("%s %s", st, msg); 901 cmdline = g_strdup_printf("%s %s", st, msg);
902 scr_LogPrint(LPRINT_LOGNORM, "Sending to <%s> /status %s", fjid, cmdline); 902 scr_LogPrint(LPRINT_LOGNORM, "Sending to <%s> /status %s", fjid, cmdline);
903 setstatus(fjid, cmdline); 903 cmd_setstatus(fjid, cmdline);
904 g_free(msg); 904 g_free(msg);
905 g_free(cmdline); 905 g_free(cmdline);
906 g_free(jid_utf8); 906 g_free(jid_utf8);
907 } 907 }
908 free_arg_lst(paramlst); 908 free_arg_lst(paramlst);
2300 g_free(reason_utf8); 2300 g_free(reason_utf8);
2301 2301
2302 free_arg_lst(paramlst); 2302 free_arg_lst(paramlst);
2303 } 2303 }
2304 2304
2305 void room_leave(gpointer bud, char *arg) 2305 void cmd_room_leave(gpointer bud, char *arg)
2306 { 2306 {
2307 gchar *roomid, *desc; 2307 gchar *roomid, *desc;
2308 const char *nickname; 2308 const char *nickname;
2309 2309
2310 nickname = buddy_getnickname(bud); 2310 nickname = buddy_getnickname(bud);
2511 } 2511 }
2512 2512
2513 free_arg_lst(paramlst); 2513 free_arg_lst(paramlst);
2514 } 2514 }
2515 2515
2516 // room_whois(..) 2516 // cmd_room_whois(..)
2517 // If interactive is TRUE, chatmode can be enabled. 2517 // If interactive is TRUE, chatmode can be enabled.
2518 void room_whois(gpointer bud, char *arg, guint interactive) 2518 void cmd_room_whois(gpointer bud, char *arg, guint interactive)
2519 { 2519 {
2520 char **paramlst; 2520 char **paramlst;
2521 gchar *nick, *buffer; 2521 gchar *nick, *buffer;
2522 const char *bjid, *realjid; 2522 const char *bjid, *realjid;
2523 const char *rst_msg; 2523 const char *rst_msg;
2727 } else if (!strcasecmp(subcmd, "kick")) { 2727 } else if (!strcasecmp(subcmd, "kick")) {
2728 if ((arg = check_room_subcommand(arg, TRUE, bud)) != NULL) 2728 if ((arg = check_room_subcommand(arg, TRUE, bud)) != NULL)
2729 room_kick(bud, arg); 2729 room_kick(bud, arg);
2730 } else if (!strcasecmp(subcmd, "leave")) { 2730 } else if (!strcasecmp(subcmd, "leave")) {
2731 if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL) 2731 if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL)
2732 room_leave(bud, arg); 2732 cmd_room_leave(bud, arg);
2733 } else if (!strcasecmp(subcmd, "names")) { 2733 } else if (!strcasecmp(subcmd, "names")) {
2734 if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL) 2734 if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL)
2735 room_names(bud, arg); 2735 room_names(bud, arg);
2736 } else if (!strcasecmp(subcmd, "nick")) { 2736 } else if (!strcasecmp(subcmd, "nick")) {
2737 if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL) 2737 if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL)
2754 } else if (!strcasecmp(subcmd, "topic")) { 2754 } else if (!strcasecmp(subcmd, "topic")) {
2755 if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL) 2755 if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL)
2756 room_topic(bud, arg); 2756 room_topic(bud, arg);
2757 } else if (!strcasecmp(subcmd, "whois")) { 2757 } else if (!strcasecmp(subcmd, "whois")) {
2758 if ((arg = check_room_subcommand(arg, TRUE, bud)) != NULL) 2758 if ((arg = check_room_subcommand(arg, TRUE, bud)) != NULL)
2759 room_whois(bud, arg, TRUE); 2759 cmd_room_whois(bud, arg, TRUE);
2760 } else if (!strcasecmp(subcmd, "bookmark")) { 2760 } else if (!strcasecmp(subcmd, "bookmark")) {
2761 if (!arg && !buddy_getjid(BUDDATA(current_buddy)) && 2761 if (!arg && !buddy_getjid(BUDDATA(current_buddy)) &&
2762 buddy_gettype(BUDDATA(current_buddy)) == ROSTER_TYPE_SPECIAL) 2762 buddy_gettype(BUDDATA(current_buddy)) == ROSTER_TYPE_SPECIAL)
2763 display_all_bookmarks(); 2763 display_all_bookmarks();
2764 else if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL) 2764 else if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL)