about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/muc_window.c39
-rw-r--r--src/ui/muc_window.h33
-rw-r--r--src/ui/window.c33
-rw-r--r--src/ui/window.h2
4 files changed, 82 insertions, 25 deletions
diff --git a/src/ui/muc_window.c b/src/ui/muc_window.c
new file mode 100644
index 00000000..ef4e1c9b
--- /dev/null
+++ b/src/ui/muc_window.c
@@ -0,0 +1,39 @@
+/*
+ * muc_window.c
+ *
+ * Copyright (C) 2012, 2013 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/>.
+ *
+ */
+
+#include <glib.h>
+
+#include "ui/window.h"
+
+gboolean
+muc_handle_error_message(ProfWin *self, const char * const from,
+    const char * const err_msg)
+{
+    gboolean handled = FALSE;
+    if (g_strcmp0(err_msg, "conflict") == 0) {
+        win_print_line(self, "Nickname already in use.");
+        win_refresh(self);
+        handled = TRUE;
+    }
+
+    return handled;
+}
diff --git a/src/ui/muc_window.h b/src/ui/muc_window.h
new file mode 100644
index 00000000..e67954a7
--- /dev/null
+++ b/src/ui/muc_window.h
@@ -0,0 +1,33 @@
+/*
+ * muc_window.h
+ *
+ * Copyright (C) 2012, 2013 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/>.
+ *
+ */
+
+#ifndef MUC_WINDOW_H
+#define MUC_WINDOW_H
+
+#include <glib.h>
+
+#include "ui/window.h"
+
+gboolean muc_handle_error_message(ProfWin *self, const char * const from,
+    const char * const err_msg);
+
+#endif
diff --git a/src/ui/window.c b/src/ui/window.c
index 13956b22..a1d5a0fc 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -34,14 +34,11 @@
 
 #include "config/theme.h"
 #include "ui/window.h"
+#include "ui/muc_window.h"
 
-static gboolean _muc_handle_error_message(ProfWin *self, const char * const from,
-    const char * const err_msg);
 static gboolean _default_handle_error_message(ProfWin *self, const char * const from,
     const char * const err_msg);
 static void _win_print_time(ProfWin *self, char show_char);
-static void _win_print_line(ProfWin *self, const char * const msg, ...);
-static void _win_refresh(ProfWin *self);
 static void _win_presence_colour_on(ProfWin *self, const char * const presence);
 static void _win_presence_colour_off(ProfWin *self, const char * const presence);
 static void _win_show_contact(ProfWin *self, PContact contact);
@@ -60,8 +57,8 @@ win_create(const char * const title, int cols, win_type_t type)
     new_win->type = type;
 
     new_win->print_time = _win_print_time;
-    new_win->print_line = _win_print_line;
-    new_win->refresh_win = _win_refresh;
+    new_win->print_line = win_print_line;
+    new_win->refresh_win = win_refresh;
     new_win->presence_colour_on = _win_presence_colour_on;
     new_win->presence_colour_off = _win_presence_colour_off;
     new_win->show_contact = _win_show_contact;
@@ -69,7 +66,7 @@ win_create(const char * const title, int cols, win_type_t type)
     switch (new_win->type)
     {
         case WIN_MUC:
-            new_win->handle_error_message = _muc_handle_error_message;
+            new_win->handle_error_message = muc_handle_error_message;
             break;
         default:
             new_win->handle_error_message = _default_handle_error_message;
@@ -102,8 +99,8 @@ _win_print_time(ProfWin* self, char show_char)
     g_free(date_fmt);
 }
 
-static void
-_win_print_line(ProfWin *self, const char * const msg, ...)
+void
+win_print_line(ProfWin *self, const char * const msg, ...)
 {
     va_list arg;
     va_start(arg, msg);
@@ -115,8 +112,8 @@ _win_print_line(ProfWin *self, const char * const msg, ...)
     va_end(arg);
 }
 
-static void
-_win_refresh(ProfWin *self)
+void
+win_refresh(ProfWin *self)
 {
     int rows, cols;
     getmaxyx(stdscr, rows, cols);
@@ -208,20 +205,6 @@ _win_show_contact(ProfWin *self, PContact contact)
 }
 
 static gboolean
-_muc_handle_error_message(ProfWin *self, const char * const from,
-    const char * const err_msg)
-{
-    gboolean handled = FALSE;
-    if (g_strcmp0(err_msg, "conflict") == 0) {
-        _win_print_line(self, "Nickname already in use.");
-        _win_refresh(self);
-        handled = TRUE;
-    }
-
-    return handled;
-}
-
-static gboolean
 _default_handle_error_message(ProfWin *self, const char * const from,
     const char * const err_msg)
 {
diff --git a/src/ui/window.h b/src/ui/window.h
index 2eec3b01..5f8a0e36 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -64,5 +64,7 @@ typedef struct prof_win_t {
 
 ProfWin* win_create(const char * const title, int cols, win_type_t type);
 void win_free(ProfWin *window);
+void win_print_line(ProfWin *self, const char * const msg, ...);
+void win_refresh(ProfWin *self);
 
 #endif
#n396'>396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492