mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Refactor mucwin_history()
Just pass ProfMessage.
This commit is contained in:
parent
cf36a92dcb
commit
6aa793fca6
@ -286,7 +286,7 @@ sv_ev_room_history(ProfMessage *message)
|
|||||||
|
|
||||||
gboolean younger = g_date_time_compare(mucwin->last_msg_timestamp, message->timestamp) < 0 ? TRUE : FALSE;
|
gboolean younger = g_date_time_compare(mucwin->last_msg_timestamp, message->timestamp) < 0 ? TRUE : FALSE;
|
||||||
if (ev_is_first_connect() || younger ) {
|
if (ev_is_first_connect() || younger ) {
|
||||||
mucwin_history(mucwin, message->jid->resourcepart, message->timestamp, message->plain);
|
mucwin_history(mucwin, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,28 +361,29 @@ mucwin_nick_change(ProfMucWin *mucwin, const char *const nick)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, const char *const message)
|
mucwin_history(ProfMucWin *mucwin, const ProfMessage *const message)
|
||||||
{
|
{
|
||||||
assert(mucwin != NULL);
|
assert(mucwin != NULL);
|
||||||
|
|
||||||
ProfWin *window = (ProfWin*)mucwin;
|
ProfWin *window = (ProfWin*)mucwin;
|
||||||
GString *line = g_string_new("");
|
GString *line = g_string_new("");
|
||||||
|
char *nick = message->jid->resourcepart;
|
||||||
|
|
||||||
if (strncmp(message, "/me ", 4) == 0) {
|
if (strncmp(message->plain, "/me ", 4) == 0) {
|
||||||
g_string_append(line, "*");
|
g_string_append(line, "*");
|
||||||
g_string_append(line, nick);
|
g_string_append(line, nick);
|
||||||
g_string_append(line, " ");
|
g_string_append(line, " ");
|
||||||
g_string_append(line, message + 4);
|
g_string_append(line, message->plain + 4);
|
||||||
} else {
|
} else {
|
||||||
g_string_append(line, nick);
|
g_string_append(line, nick);
|
||||||
g_string_append(line, ": ");
|
g_string_append(line, ": ");
|
||||||
g_string_append(line, message);
|
g_string_append(line, message->plain);
|
||||||
}
|
}
|
||||||
|
|
||||||
win_print_history(window, timestamp, line->str);
|
win_print_history(window, message->timestamp, line->str);
|
||||||
g_string_free(line, TRUE);
|
g_string_free(line, TRUE);
|
||||||
|
|
||||||
plugins_on_room_history_message(mucwin->roomjid, nick, message, timestamp);
|
plugins_on_room_history_message(mucwin->roomjid, nick, message->plain, message->timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -156,7 +156,7 @@ void mucwin_occupant_affiliation_change(ProfMucWin *mucwin, const char *const ni
|
|||||||
void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char *const nick,
|
void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char *const nick,
|
||||||
const char *const role, const char *const affiliation, const char *const actor, const char *const reason);
|
const char *const role, const char *const affiliation, const char *const actor, const char *const reason);
|
||||||
void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char *const presence);
|
void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char *const presence);
|
||||||
void mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, const char *const message);
|
void mucwin_history(ProfMucWin *mucwin, const ProfMessage *const message);
|
||||||
void mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *const id, prof_enc_t enc_mode, const char *const replace_id);
|
void mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *const id, prof_enc_t enc_mode, const char *const replace_id);
|
||||||
void mucwin_incoming_msg(ProfMucWin *mucwin, ProfMessage *message, GSList *mentions, GList *triggers);
|
void mucwin_incoming_msg(ProfMucWin *mucwin, ProfMessage *message, GSList *mentions, GList *triggers);
|
||||||
void mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const subject);
|
void mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const subject);
|
||||||
|
Loading…
Reference in New Issue
Block a user