about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorWill Song <incertia9474@gmail.com>2015-11-24 18:02:48 -0600
committerWill Song <incertia9474@gmail.com>2015-11-24 18:02:48 -0600
commitc4a1e7da9b4c41395d1bec27fea3b47b387e86a6 (patch)
tree523c8aca9b985fccc31813b857a595e8914cd346
parent35b8d58270211b6249fc692e61b331ef25b7a089 (diff)
downloadprofani-tty-c4a1e7da9b4c41395d1bec27fea3b47b387e86a6.tar.gz
show different message when one is not connected
-rw-r--r--src/command/commands.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 2c3b6352..dc562e81 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -821,7 +821,13 @@ _writecsv(int fd, const char *const str)
 gboolean
 cmd_export(ProfWin *window, const char *const command, gchar **args)
 {
-    if(args[0]){
+    jabber_conn_status_t conn_status = jabber_get_connection_status();
+
+    if (conn_status != JABBER_CONNECTED) {
+        cons_show("You are not currently connected.");
+        cons_show("");
+        return TRUE;
+    } else if(args[0]) {
         int fd = open(args[0], O_WRONLY | O_CREAT, 00600);
         GSList *list = NULL;
 
@@ -843,9 +849,9 @@ cmd_export(ProfWin *window, const char *const command, gchar **args)
 
                 /* write the data to the file */
                 if(-1 == write(fd, "\"", 1)) goto write_error;
-                if(-1 == writecsv(fd, jid)) goto write_error;
+                if(-1 == _writecsv(fd, jid)) goto write_error;
                 if(-1 == write(fd, "\",\"", 3)) goto write_error;
-                if(-1 == writecsv(fd, name)) goto write_error;
+                if(-1 == _writecsv(fd, name)) goto write_error;
                 if(-1 == write(fd, "\"\n", 2)) goto write_error;
 
                 /* loop */