mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Handle incoming groupchat
This commit is contained in:
parent
ad8845991c
commit
0023422830
10
src/jabber.c
10
src/jabber.c
@ -418,10 +418,16 @@ _message_handler(xmpp_conn_t * const conn,
|
|||||||
log_error("Couldn't parse datetime string receiving room history: %s", utc_stamp);
|
log_error("Couldn't parse datetime string receiving room history: %s", utc_stamp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// handle normal groupchat messages
|
xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, "body");
|
||||||
|
if (body != NULL) {
|
||||||
|
char *message = xmpp_stanza_get_text(body);
|
||||||
|
char **tokens = g_strsplit(from, "/", 0);
|
||||||
|
char *room_jid = tokens[0];
|
||||||
|
char *nick = tokens[1];
|
||||||
|
win_show_room_message(room_jid, nick, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cons_show("CHAT ROOM MESSAGE RECIEVED");
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (type != NULL) {
|
if (type != NULL) {
|
||||||
|
2
src/ui.h
2
src/ui.h
@ -109,6 +109,8 @@ void win_show_chat_room_member(const char * const room_jid,
|
|||||||
int win_in_groupchat(void);
|
int win_in_groupchat(void);
|
||||||
void win_show_room_history(const char * const room_jid, const char * const nick,
|
void win_show_room_history(const char * const room_jid, const char * const nick,
|
||||||
GTimeVal tv_stamp, const char * const message);
|
GTimeVal tv_stamp, const char * const message);
|
||||||
|
void win_show_room_message(const char * const room_jid, const char * const nick,
|
||||||
|
const char * const message);
|
||||||
|
|
||||||
// console window actions
|
// console window actions
|
||||||
void cons_about(void);
|
void cons_about(void);
|
||||||
|
@ -528,6 +528,21 @@ win_show_room_history(const char * const room_jid, const char * const nick,
|
|||||||
dirty = TRUE;
|
dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
win_show_room_message(const char * const room_jid, const char * const nick,
|
||||||
|
const char * const message)
|
||||||
|
{
|
||||||
|
int win_index = _find_prof_win_index(room_jid);
|
||||||
|
WINDOW *win = _wins[win_index].win;
|
||||||
|
|
||||||
|
_win_show_time(win);
|
||||||
|
_win_show_user(win, nick, 1);
|
||||||
|
_win_show_message(win, message);
|
||||||
|
|
||||||
|
if (win_index == _curr_prof_win)
|
||||||
|
dirty = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
win_show(const char * const msg)
|
win_show(const char * const msg)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user