about summary refs log tree commit diff stats
path: root/src/plugins
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-02-28 23:06:45 +0000
committerJames Booth <boothj5@gmail.com>2016-02-28 23:06:45 +0000
commitab08d0a3780474b1b01e23acb2985bcb7de7439e (patch)
tree59c41e71453b1e85605718987f32b2d764f578e9 /src/plugins
parentc562702ab9e1c456c488030b0f294616749dc838 (diff)
downloadprofani-tty-ab08d0a3780474b1b01e23acb2985bcb7de7439e.tar.gz
Added current_win_is_console to plugins api
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/api.c11
-rw-r--r--src/plugins/api.h2
-rw-r--r--src/plugins/c_api.c7
-rw-r--r--src/plugins/profapi.c1
-rw-r--r--src/plugins/profapi.h1
5 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/api.c b/src/plugins/api.c
index 495a0d58..a3740f2f 100644
--- a/src/plugins/api.c
+++ b/src/plugins/api.c
@@ -197,6 +197,17 @@ api_get_current_muc(void)
     }
 }
 
+int
+api_current_win_is_console(void)
+{
+    ProfWin *current = wins_get_current();
+    if (current && current->type == WIN_CONSOLE) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
 void
 api_log_debug(const char *message)
 {
diff --git a/src/plugins/api.h b/src/plugins/api.h
index 3f1b7d1c..b56be781 100644
--- a/src/plugins/api.h
+++ b/src/plugins/api.h
@@ -43,8 +43,10 @@ int api_cons_show_themed(const char *const group, const char *const item, const
 int api_cons_bad_cmd_usage(const char *const cmd);
 void api_notify(const char *message, const char *category, int timeout_ms);
 void api_send_line(char *line);
+
 char * api_get_current_recipient(void);
 char * api_get_current_muc(void);
+gboolean api_current_win_is_console(void);
 
 void api_register_command(const char *command_name, int min_args, int max_args,
     const char **synopsis, const char *description, const char *arguments[][2], const char **examples,
diff --git a/src/plugins/c_api.c b/src/plugins/c_api.c
index e2b7517a..d8619c49 100644
--- a/src/plugins/c_api.c
+++ b/src/plugins/c_api.c
@@ -126,6 +126,12 @@ c_api_get_current_muc(void)
     return api_get_current_muc();
 }
 
+static int
+c_api_current_win_is_console()
+{
+    return api_current_win_is_console();
+}
+
 static void
 c_api_log_debug(const char *message)
 {
@@ -220,6 +226,7 @@ c_api_init(void)
     prof_send_line = c_api_send_line;
     prof_get_current_recipient = c_api_get_current_recipient;
     prof_get_current_muc = c_api_get_current_muc;
+    prof_current_win_is_console = c_api_current_win_is_console;
     prof_log_debug = c_api_log_debug;
     prof_log_info = c_api_log_info;
     prof_log_warning = c_api_log_warning;
diff --git a/src/plugins/profapi.c b/src/plugins/profapi.c
index 5157ec72..84670c33 100644
--- a/src/plugins/profapi.c
+++ b/src/plugins/profapi.c
@@ -56,6 +56,7 @@ void (*prof_send_line)(char *line) = NULL;
 
 char* (*prof_get_current_recipient)(void) = NULL;
 char* (*prof_get_current_muc)(void) = NULL;
+int (*prof_current_win_is_console)(void) = NULL;
 
 void (*prof_log_debug)(const char *message) = NULL;
 void (*prof_log_info)(const char *message) = NULL;
diff --git a/src/plugins/profapi.h b/src/plugins/profapi.h
index 1be99820..77288f94 100644
--- a/src/plugins/profapi.h
+++ b/src/plugins/profapi.h
@@ -56,6 +56,7 @@ void (*prof_send_line)(char *line);
 
 char* (*prof_get_current_recipient)(void);
 char* (*prof_get_current_muc)(void);
+int (*prof_current_win_is_console)(void);
 
 void (*prof_log_debug)(const char *message);
 void (*prof_log_info)(const char *message);