about summary refs log tree commit diff stats
path: root/src/command/commands.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-02 01:57:05 +0000
committerJames Booth <boothj5@gmail.com>2014-01-02 01:57:05 +0000
commit170af88c0dc736087d40d3591c1880d8af17b5e6 (patch)
tree29c912e2fe3261e758691254dbddbe43c6d139c7 /src/command/commands.c
parentbc700fbfeac560946991063313f293a9861d4d1d (diff)
parent3fbd45bd0603d51255c9e6df2a56d5cd5de4dd2b (diff)
downloadprofani-tty-170af88c0dc736087d40d3591c1880d8af17b5e6.tar.gz
Merge branch 'master' into otr
Conflicts:
	Makefile.am
Diffstat (limited to 'src/command/commands.c')
-rw-r--r--src/command/commands.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index d962ce6d..87cf7996 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -267,7 +267,8 @@ cmd_account(gchar **args, struct cmd_help_t help)
                                 resource_presence_t last_presence = accounts_get_last_presence(connected_account);
 
                                 if (presence_type == last_presence) {
-                                    presence_update(last_presence, jabber_get_presence_message(), 0);
+                                    char *message = jabber_get_presence_message();
+                                    presence_update(last_presence, message, 0);
                                 }
                             }
                             cons_show("Updated %s priority for account %s: %s", property, account_name, value);
@@ -311,7 +312,6 @@ gboolean
 cmd_sub(gchar **args, struct cmd_help_t help)
 {
     jabber_conn_status_t conn_status = jabber_get_connection_status();
-    win_type_t win_type = ui_current_win_type();
 
     if (conn_status != JABBER_CONNECTED) {
         cons_show("You are currently not connected.");
@@ -337,6 +337,7 @@ cmd_sub(gchar **args, struct cmd_help_t help)
         return TRUE;
     }
 
+    win_type_t win_type = ui_current_win_type();
     if ((win_type != WIN_CHAT) && (jid == NULL)) {
         cons_show("You must specify a contact.");
         return TRUE;
@@ -2334,11 +2335,11 @@ _strtoi(char *str, int *saveptr, int min, int max)
 
     errno = 0;
     val = (int)strtol(str, &ptr, 0);
-    if (*str == '\0' || *ptr != '\0') {
-        cons_show("Illegal character. Must be a number.");
+    if (errno != 0 || *str == '\0' || *ptr != '\0') {
+        cons_show("Could not convert \"%s\" to a number.", str);
         return -1;
-    } else if (errno == ERANGE || val < min || val > max) {
-        cons_show("Value out of range. Must be in %d..%d.", min, max);
+    } else if (val < min || val > max) {
+        cons_show("Value %s out of range. Must be in %d..%d.", str, min, max);
         return -1;
     }