about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-11-01 19:39:36 +0000
committerJames Booth <boothj5@gmail.com>2015-11-01 19:39:36 +0000
commitdb4bcd3e6d6efa9bae1d85b327a9f0318177555f (patch)
tree00be271e744e64aa2d742666e70c248afda43487 /src/ui
parent7e386fbf005a9c990d288750c336db8e981eaee1 (diff)
downloadprofani-tty-db4bcd3e6d6efa9bae1d85b327a9f0318177555f.tar.gz
Added xmlwin module
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/core.c20
-rw-r--r--src/ui/ui.h4
-rw-r--r--src/ui/xmlwin.c56
3 files changed, 59 insertions, 21 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index f8c8b7c6..d50f1c3d 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -223,26 +223,6 @@ ui_load_colours(void)
 }
 
 void
-ui_handle_stanza(const char *const msg)
-{
-    ProfXMLWin *xmlwin = wins_get_xmlconsole();
-    if (!xmlwin) {
-        return;
-    }
-
-    ProfWin *window = (ProfWin*)xmlwin;
-    if (g_str_has_prefix(msg, "SENT:")) {
-        win_print(window, '-', 0, NULL, 0, 0, "", "SENT:");
-        win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", &msg[6]);
-        win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", "");
-    } else if (g_str_has_prefix(msg, "RECV:")) {
-        win_print(window, '-', 0, NULL, 0, 0, "", "RECV:");
-        win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", &msg[6]);
-        win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", "");
-    }
-}
-
-void
 ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity)
 {
     char *show_console = prefs_get_string(PREF_STATUSES_CONSOLE);
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 9f7cf46a..6520358a 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -85,7 +85,6 @@ int ui_win_unread(int index);
 char* ui_ask_password(void);
 char* ui_get_line(void);
 char* ui_ask_pgp_passphrase(const char *hint, int prev_fail);
-void ui_handle_stanza(const char *const msg);
 void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity);
 void ui_contact_typing(const char *const barejid, const char *const resource);
 void ui_incoming_private_msg(const char *const fulljid, const char *const message, GDateTime *timestamp);
@@ -209,6 +208,9 @@ void chatwin_otr_untrust(ProfChatWin *chatwin);
 void chatwin_otr_smp_event(ProfChatWin *chatwin, prof_otr_smp_event_t event, void *data);
 #endif
 
+// xml console
+void xmlwin_show(const char *const msg);
+
 // Input window
 char* inp_readline(void);
 void inp_nonblocking(gboolean reset);
diff --git a/src/ui/xmlwin.c b/src/ui/xmlwin.c
new file mode 100644
index 00000000..d793fd05
--- /dev/null
+++ b/src/ui/xmlwin.c
@@ -0,0 +1,56 @@
+/*
+ * xmlwin.c
+ *
+ * Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
+ *
+ * This file is part of Profanity.
+ *
+ * Profanity is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Profanity is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Profanity.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * In addition, as a special exception, the copyright holders give permission to
+ * link the code of portions of this program with the OpenSSL library under
+ * certain conditions as described in each individual source file, and
+ * distribute linked combinations including the two.
+ *
+ * You must obey the GNU General Public License in all respects for all of the
+ * code used other than OpenSSL. If you modify file(s) with this exception, you
+ * may extend this exception to your version of the file(s), but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version. If you delete this exception statement from all
+ * source files in the program, then also delete it here.
+ *
+ */
+
+#include "ui/win_types.h"
+#include "window_list.h"
+
+void
+xmlwin_show(const char *const msg)
+{
+    ProfXMLWin *xmlwin = wins_get_xmlconsole();
+    if (!xmlwin) {
+        return;
+    }
+
+    ProfWin *window = (ProfWin*)xmlwin;
+    if (g_str_has_prefix(msg, "SENT:")) {
+        win_print(window, '-', 0, NULL, 0, 0, "", "SENT:");
+        win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", &msg[6]);
+        win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", "");
+    } else if (g_str_has_prefix(msg, "RECV:")) {
+        win_print(window, '-', 0, NULL, 0, 0, "", "RECV:");
+        win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", &msg[6]);
+        win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", "");
+    }
+}