1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Removed print message function from ProfWin

This commit is contained in:
James Booth 2014-01-08 20:11:53 +00:00
parent 71356967ab
commit d99f1536ec
3 changed files with 26 additions and 12 deletions

View File

@ -252,7 +252,7 @@ _ui_incoming_msg(const char * const from, const char * const message,
// currently viewing chat window with sender
if (wins_is_current(window)) {
window->print_incoming_message(window, tv_stamp, display_from, message);
win_print_incoming_message(window, tv_stamp, display_from, message);
title_bar_set_typing(FALSE);
title_bar_draw();
status_bar_active(num);
@ -278,7 +278,7 @@ _ui_incoming_msg(const char * const from, const char * const message,
}
}
window->print_incoming_message(window, tv_stamp, display_from, message);
win_print_incoming_message(window, tv_stamp, display_from, message);
}
int ui_index = num;

View File

@ -24,6 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <glib.h>
#ifdef HAVE_NCURSESW_NCURSES_H
@ -38,7 +39,7 @@
static gboolean _default_handle_error_message(ProfWin *self, const char * const from,
const char * const err_msg);
static void _print_incoming_message(ProfWin *self, GTimeVal *tv_stamp,
static void _win_chat_print_incoming_message(ProfWin *self, GTimeVal *tv_stamp,
const char * const from, const char * const message);
ProfWin*
@ -58,27 +59,21 @@ win_create(const char * const title, int cols, win_type_t type)
{
case WIN_CONSOLE:
new_win->handle_error_message = _default_handle_error_message;
new_win->print_incoming_message = NULL;
break;
case WIN_CHAT:
new_win->handle_error_message = _default_handle_error_message;
new_win->print_incoming_message = _print_incoming_message;
break;
case WIN_MUC:
new_win->handle_error_message = muc_handle_error_message;
new_win->print_incoming_message = NULL;
break;
case WIN_PRIVATE:
new_win->handle_error_message = _default_handle_error_message;
new_win->print_incoming_message = _print_incoming_message;
break;
case WIN_DUCK:
new_win->handle_error_message = _default_handle_error_message;
new_win->print_incoming_message = NULL;
break;
default:
new_win->handle_error_message = _default_handle_error_message;
new_win->print_incoming_message = NULL;
break;
}
@ -314,6 +309,25 @@ win_show_status_string(ProfWin *window, const char * const from,
}
}
void
win_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp,
const char * const from, const char * const message)
{
switch (window->type)
{
case WIN_CHAT:
case WIN_PRIVATE:
_win_chat_print_incoming_message(window, tv_stamp, from, message);
break;
case WIN_DUCK:
case WIN_CONSOLE:
case WIN_MUC:
default:
assert(FALSE);
break;
}
}
static gboolean
_default_handle_error_message(ProfWin *self, const char * const from,
const char * const err_msg)
@ -322,7 +336,7 @@ _default_handle_error_message(ProfWin *self, const char * const from,
}
static void
_print_incoming_message(ProfWin *self, GTimeVal *tv_stamp,
_win_chat_print_incoming_message(ProfWin *self, GTimeVal *tv_stamp,
const char * const from, const char * const message)
{
if (tv_stamp == NULL) {

View File

@ -54,8 +54,6 @@ typedef struct prof_win_t {
int history_shown;
gboolean (*handle_error_message)(struct prof_win_t *self,
const char * const from, const char * const err_msg);
void (*print_incoming_message)(struct prof_win_t *self, GTimeVal *tv_stamp,
const char * const from, const char * const message);
} ProfWin;
ProfWin* win_create(const char * const title, int cols, win_type_t type);
@ -72,5 +70,7 @@ void win_show_status_string(ProfWin *window, const char * const from,
const char * const show, const char * const status,
GDateTime *last_activity, const char * const pre,
const char * const default_show);
void win_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp,
const char * const from, const char * const message);
#endif