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

mucwin_history takes ProfMucWin

This commit is contained in:
James Booth 2015-11-02 00:19:46 +00:00
parent 6ed72d8a35
commit e68784be43
4 changed files with 23 additions and 25 deletions

View File

@ -155,7 +155,10 @@ void
sv_ev_room_history(const char *const room_jid, const char *const nick,
GDateTime *timestamp, const char *const message)
{
mucwin_history(room_jid, nick, timestamp, message);
ProfMucWin *mucwin = wins_get_muc(room_jid);
if (mucwin) {
mucwin_history(mucwin, nick, timestamp, message);
}
}
void

View File

@ -332,29 +332,26 @@ mucwin_nick_change(ProfMucWin *mucwin, const char *const nick)
}
void
mucwin_history(const char *const roomjid, const char *const nick,
GDateTime *timestamp, const char *const message)
mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, const char *const message)
{
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) {
log_error("Room history message received from %s, but no window open for %s", nick, roomjid);
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
GString *line = g_string_new("");
if (strncmp(message, "/me ", 4) == 0) {
g_string_append(line, "*");
g_string_append(line, nick);
g_string_append(line, " ");
g_string_append(line, message + 4);
} else {
GString *line = g_string_new("");
if (strncmp(message, "/me ", 4) == 0) {
g_string_append(line, "*");
g_string_append(line, nick);
g_string_append(line, " ");
g_string_append(line, message + 4);
} else {
g_string_append(line, nick);
g_string_append(line, ": ");
g_string_append(line, message);
}
win_print(window, '-', 0, timestamp, NO_COLOUR_DATE, 0, "", line->str);
g_string_free(line, TRUE);
g_string_append(line, nick);
g_string_append(line, ": ");
g_string_append(line, message);
}
win_print(window, '-', 0, timestamp, NO_COLOUR_DATE, 0, "", line->str);
g_string_free(line, TRUE);
}
void

View File

@ -173,8 +173,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,
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_history(const char *const roomjid, const char *const nick, GDateTime *timestamp,
const char *const message);
void mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, const char *const message);
void mucwin_message(const char *const roomjid, const char *const nick, const char *const message);
void mucwin_subject(const char *const roomjid, const char *const nick, const char *const subject);
void mucwin_requires_config(const char *const roomjid);

View File

@ -204,8 +204,7 @@ void mucwin_occupant_affiliation_change(ProfMucWin *mucwin, const char * const n
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) {}
void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char * const presence) {}
void mucwin_history(const char * const roomjid, const char * const nick,
GDateTime *timestamp, const char * const message) {}
void mucwin_history(ProfMucWin *mucwin, const char * const nick, GDateTime *timestamp, const char * const message) {}
void mucwin_message(const char * const roomjid, const char * const nick,
const char * const message) {}
void mucwin_subject(const char * const roomjid, const char * const nick, const char * const subject) {}