diff options
author | James Booth <boothj5@gmail.com> | 2015-10-27 23:18:42 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-10-27 23:18:42 +0000 |
commit | af1124f28ffc95a09d88d1fad25c31554106acd7 (patch) | |
tree | 7bb810dd99e29bdda615e5f6071223d8d7fdf69c | |
parent | ea09dcda1850cb6fa29f9c1ca8efac870e033625 (diff) | |
download | profani-tty-af1124f28ffc95a09d88d1fad25c31554106acd7.tar.gz |
Renamed ui_incoming_msg -> chatwin_incoming_msg
-rw-r--r-- | src/event/server_events.c | 12 | ||||
-rw-r--r-- | src/ui/chatwin.c | 48 | ||||
-rw-r--r-- | src/ui/ui.h | 2 | ||||
-rw-r--r-- | tests/unittests/ui/stub_ui.c | 2 |
4 files changed, 32 insertions, 32 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c index 7d5ff5fe..e4d19953 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -194,7 +194,7 @@ sv_ev_incoming_carbon(char *barejid, char *resource, char *message) new_win = TRUE; } - ui_incoming_msg(chatwin, resource, message, NULL, new_win, PROF_MSG_PLAIN); + chatwin_incoming_msg(chatwin, resource, message, NULL, new_win, PROF_MSG_PLAIN); chat_log_msg_in(barejid, message, NULL); } @@ -204,12 +204,12 @@ _sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, char *barejid, char { char *decrypted = p_gpg_decrypt(pgp_message); if (decrypted) { - ui_incoming_msg(chatwin, resource, decrypted, timestamp, new_win, PROF_MSG_PGP); + chatwin_incoming_msg(chatwin, resource, decrypted, timestamp, new_win, PROF_MSG_PGP); chat_log_pgp_msg_in(barejid, decrypted, timestamp); chatwin->pgp_recv = TRUE; p_gpg_free_decrypted(decrypted); } else { - ui_incoming_msg(chatwin, resource, message, timestamp, new_win, PROF_MSG_PLAIN); + chatwin_incoming_msg(chatwin, resource, message, timestamp, new_win, PROF_MSG_PLAIN); chat_log_msg_in(barejid, message, timestamp); chatwin->pgp_recv = FALSE; } @@ -224,10 +224,10 @@ _sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, char *barejid, char char *otr_res = otr_on_message_recv(barejid, resource, message, &decrypted); if (otr_res) { if (decrypted) { - ui_incoming_msg(chatwin, resource, otr_res, timestamp, new_win, PROF_MSG_OTR); + chatwin_incoming_msg(chatwin, resource, otr_res, timestamp, new_win, PROF_MSG_OTR); chatwin->pgp_send = FALSE; } else { - ui_incoming_msg(chatwin, resource, otr_res, timestamp, new_win, PROF_MSG_PLAIN); + chatwin_incoming_msg(chatwin, resource, otr_res, timestamp, new_win, PROF_MSG_PLAIN); } chat_log_otr_msg_in(barejid, otr_res, decrypted, timestamp); otr_free_message(otr_res); @@ -240,7 +240,7 @@ _sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, char *barejid, char static void _sv_ev_incoming_plain(ProfChatWin *chatwin, gboolean new_win, char *barejid, char *resource, char *message, GDateTime *timestamp) { - ui_incoming_msg(chatwin, resource, message, timestamp, new_win, PROF_MSG_PLAIN); + chatwin_incoming_msg(chatwin, resource, message, timestamp, new_win, PROF_MSG_PLAIN); chat_log_msg_in(barejid, message, timestamp); chatwin->pgp_recv = FALSE; } diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index 2ef35b10..1202be9c 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -47,6 +47,29 @@ static void _win_show_history(ProfChatWin *chatwin, const char *const contact); +ProfChatWin* +chatwin_new(const char *const barejid) +{ + ProfWin *window = wins_new_chat(barejid); + ProfChatWin *chatwin = (ProfChatWin *)window; + + if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) { + _win_show_history(chatwin, barejid); + } + + // if the contact is offline, show a message + PContact contact = roster_get_contact(barejid); + if (contact) { + if (strcmp(p_contact_presence(contact), "offline") == 0) { + const char * const show = p_contact_presence(contact); + const char * const status = p_contact_status(contact); + win_show_status_string(window, barejid, show, status, NULL, "--", "offline"); + } + } + + return chatwin; +} + void chatwin_receipt_received(ProfChatWin *chatwin, const char *const id) { @@ -197,31 +220,8 @@ chatwin_recipient_gone(ProfChatWin *chatwin) win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, THEME_GONE, "", "<- %s has left the conversation.", display_usr); } -ProfChatWin* -chatwin_new(const char *const barejid) -{ - ProfWin *window = wins_new_chat(barejid); - ProfChatWin *chatwin = (ProfChatWin *)window; - - if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) { - _win_show_history(chatwin, barejid); - } - - // if the contact is offline, show a message - PContact contact = roster_get_contact(barejid); - if (contact) { - if (strcmp(p_contact_presence(contact), "offline") == 0) { - const char * const show = p_contact_presence(contact); - const char * const status = p_contact_status(contact); - win_show_status_string(window, barejid, show, status, NULL, "--", "offline"); - } - } - - return chatwin; -} - void -ui_incoming_msg(ProfChatWin *chatwin, const char *const resource, const char *const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode) +chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const char *const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode) { ProfWin *window = (ProfWin*)chatwin; int num = wins_get_num(window); diff --git a/src/ui/ui.h b/src/ui/ui.h index 1214fdab..fb56b6e1 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -99,7 +99,7 @@ void ui_handle_stanza(const char *const msg); // ui events 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_msg(ProfChatWin *chatwin, const char *const resource, const char *const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode); +void chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const char *const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode); void ui_incoming_private_msg(const char *const fulljid, const char *const message, GDateTime *timestamp); void chatwin_receipt_received(ProfChatWin *chatwin, const char *const id); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 0069ee8b..0a13f8ec 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -173,7 +173,7 @@ void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activi } void ui_contact_typing(const char * const barejid, const char * const resource) {} -void ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char * const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode) {} +void chatwin_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char * const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode) {} void chatwin_receipt_received(ProfChatWin *chatwin, const char * const id) {} void ui_incoming_private_msg(const char * const fulljid, const char * const message, GDateTime *timestamp) {} |