1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Renamed ui_incoming_msg -> chatwin_incoming_msg

This commit is contained in:
James Booth 2015-10-27 23:18:42 +00:00
parent ea09dcda18
commit af1124f28f
4 changed files with 32 additions and 32 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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) {}