about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-01-15 21:58:41 +0000
committerJames Booth <boothj5@gmail.com>2013-01-15 21:58:41 +0000
commitefdd3e55dbe330b13824222343b4d505270b7ab4 (patch)
tree6c772d101e25a8597fc046dd41c99ee56bee9a66 /src
parent3ea95346c9fef3497c468d0eb333a9bd121cb462 (diff)
downloadprofani-tty-efdd3e55dbe330b13824222343b4d505270b7ab4.tar.gz
Fixed /tiny for room and private chat
Diffstat (limited to 'src')
-rw-r--r--src/command.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/command.c b/src/command.c
index 4d30d992..5c42417d 100644
--- a/src/command.c
+++ b/src/command.c
@@ -324,7 +324,6 @@ static struct cmd_t main_commands[] =
         { "/tiny url",
           "---------",
           "Send the url as a tiny url.",
-          "This command can only be called when in a chat window, not from the console.",
           "",
           "Example : /tiny http://www.google.com",
           NULL } } },
@@ -1662,24 +1661,35 @@ _cmd_tiny(gchar **args, struct cmd_help_t help)
         GString *error = g_string_new("/tiny, badly formed URL: ");
         g_string_append(error, url);
         cons_bad_show(error->str);
-        if (win_current_is_chat()) {
+        if (!win_current_is_console()) {
             win_current_bad_show(error->str);
         }
         g_string_free(error, TRUE);
-    } else if (win_current_is_chat()) {
+    } else if (!win_current_is_console()) {
         char *tiny = tinyurl_get(url);
 
         if (tiny != NULL) {
-            char *recipient = win_current_get_recipient();
-            jabber_send(tiny, recipient);
+            if (win_current_is_chat()) {
+                char *recipient = win_current_get_recipient();
+                jabber_send(tiny, recipient);
 
-            if (prefs_get_chlog()) {
-                const char *jid = jabber_get_jid();
-                chat_log_chat(jid, recipient, tiny, PROF_OUT_LOG, NULL);
-            }
+                if (prefs_get_chlog()) {
+                    const char *jid = jabber_get_jid();
+                    chat_log_chat(jid, recipient, tiny, PROF_OUT_LOG, NULL);
+                }
 
-            win_show_outgoing_msg("me", recipient, tiny);
-            free(recipient);
+                win_show_outgoing_msg("me", recipient, tiny);
+                free(recipient);
+            } else if (win_current_is_private()) {
+                char *recipient = win_current_get_recipient();
+                jabber_send(tiny, recipient);
+                win_show_outgoing_msg("me", recipient, tiny);
+                free(recipient);
+            } else { // groupchat
+                char *recipient = win_current_get_recipient();
+                jabber_send_groupchat(tiny, recipient);
+                free(recipient);
+            }
             free(tiny);
         } else {
             cons_bad_show("Couldn't get tinyurl.");