1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Merge branch 'master' into xep-0184

Conflicts:
	src/server_events.c
	src/ui/core.c
	src/ui/ui.h
	tests/ui/stub_ui.c
This commit is contained in:
James Booth 2015-03-14 23:10:51 +00:00
commit ca30ff3910
4 changed files with 47 additions and 3 deletions

View File

@ -309,8 +309,9 @@ handle_incoming_private_message(char *fulljid, char *message)
}
void
handle_carbon(char *barejid, char *message){
ui_outgoing_chat_msg(barejid, message, NULL);
handle_carbon(char *barejid, char *message)
{
ui_outgoing_chat_msg_carbon(barejid, message);
}
void
@ -842,4 +843,4 @@ handle_muc_occupant_online(const char * const room, const char * const nick, con
}
occupantswin_occupants(room);
}
}
}

View File

@ -1464,6 +1464,47 @@ ui_outgoing_chat_msg(const char * const barejid, const char * const message, cha
ui_switch_win(num);
}
void
ui_outgoing_chat_msg_carbon(const char * const barejid, const char * const message)
{
PContact contact = roster_get_contact(barejid);
ProfWin *window = (ProfWin*)wins_get_chat(barejid);
int num = 0;
// create new window
if (window == NULL) {
window = wins_new_chat(barejid);
#ifdef HAVE_LIBOTR
ProfChatWin *chatwin = (ProfChatWin*)window;
if (otr_is_secure(barejid)) {
chatwin->is_otr = TRUE;
}
#endif
num = wins_get_num(window);
if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
_win_show_history(num, barejid);
}
if (contact != NULL) {
if (strcmp(p_contact_presence(contact), "offline") == 0) {
const char *show = p_contact_presence(contact);
const char *status = p_contact_status(contact);
win_show_status_string(window, barejid, show, status, NULL, "--", "offline");
}
}
// use existing window
} else {
num = wins_get_num(window);
}
ProfChatWin *chatwin = (ProfChatWin*)window;
chat_state_active(chatwin->state);
win_print(window, '-', NULL, 0, THEME_TEXT_ME, "me", message);
status_bar_active(num);
}
void
ui_outgoing_private_msg(const char * const fulljid, const char * const message)
{

View File

@ -122,6 +122,7 @@ void ui_disconnected(void);
void ui_recipient_gone(const char * const barejid, const char * const resource);
void ui_outgoing_chat_msg(const char * const barejid, const char * const message, char *id);
void ui_outgoing_chat_msg_carbon(const char * const barejid, const char * const message);
void ui_outgoing_private_msg(const char * const fulljid, const char * const message);
void ui_room_join(const char * const roomjid, gboolean focus);

View File

@ -202,6 +202,7 @@ void ui_disconnected(void) {}
void ui_recipient_gone(const char * const barejid, const char * const resource) {}
void ui_outgoing_chat_msg(const char * const barejid, const char * const message, char *id) {}
void ui_outgoing_chat_msg_carbon(const char * const barejid, const char * const message) {}
void ui_outgoing_private_msg(const char * const fulljid, const char * const message) {}
void ui_room_join(const char * const roomjid, gboolean focus) {}