Mercurial > hg
comparison mcabber/src/commands.c @ 797:5eb701c1bc1f
Multi-line mode: Do not send empty messages
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 09 Apr 2006 10:14:39 +0200 |
parents | 79c8823da808 |
children | f6cda389db48 |
comparison
equal
deleted
inserted
replaced
796:79c8823da808 | 797:5eb701c1bc1f |
---|---|
820 } | 820 } |
821 | 821 |
822 scr_set_chatmode(TRUE); | 822 scr_set_chatmode(TRUE); |
823 | 823 |
824 if (!strcasecmp(subcmd, "send_to")) { | 824 if (!strcasecmp(subcmd, "send_to")) { |
825 int err; | 825 int err = FALSE; |
826 gchar *msg_utf8; | 826 gchar *msg_utf8; |
827 // Let's send to the specified JID. We leave now if there | 827 // Let's send to the specified JID. We leave now if there |
828 // has been an error (so we don't leave multi-line mode). | 828 // has been an error (so we don't leave multi-line mode). |
829 arg = to_utf8(arg); | 829 arg = to_utf8(arg); |
830 msg_utf8 = to_utf8(scr_get_multiline()); | 830 msg_utf8 = to_utf8(scr_get_multiline()); |
831 err = send_message_to(arg, msg_utf8); | 831 if (msg_utf8) { |
832 g_free(msg_utf8); | 832 err = send_message_to(arg, msg_utf8); |
833 g_free(msg_utf8); | |
834 } | |
833 g_free(arg); | 835 g_free(arg); |
834 if (err) | 836 if (err) |
835 return; | 837 return; |
836 } else { // Send to currently selected buddy | 838 } else { // Send to currently selected buddy |
837 gpointer bud; | 839 gpointer bud; |
848 return; | 850 return; |
849 } | 851 } |
850 | 852 |
851 buddy_setflags(bud, ROSTER_FLAG_LOCK, TRUE); | 853 buddy_setflags(bud, ROSTER_FLAG_LOCK, TRUE); |
852 msg_utf8 = to_utf8(scr_get_multiline()); | 854 msg_utf8 = to_utf8(scr_get_multiline()); |
853 send_message(msg_utf8); | 855 if (msg_utf8) { |
854 g_free(msg_utf8); | 856 send_message(msg_utf8); |
857 g_free(msg_utf8); | |
858 } | |
855 } | 859 } |
856 scr_set_multimode(FALSE); | 860 scr_set_multimode(FALSE); |
861 scr_LogPrint(LPRINT_NORMAL, "You have left multi-line message mode."); | |
857 } | 862 } |
858 | 863 |
859 static void do_say_to(char *arg) | 864 static void do_say_to(char *arg) |
860 { | 865 { |
861 char **paramlst; | 866 char **paramlst; |