1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05: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 void
handle_carbon(char *barejid, char *message){ handle_carbon(char *barejid, char *message)
ui_outgoing_chat_msg(barejid, message, NULL); {
ui_outgoing_chat_msg_carbon(barejid, message);
} }
void void
@ -842,4 +843,4 @@ handle_muc_occupant_online(const char * const room, const char * const nick, con
} }
occupantswin_occupants(room); 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); 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 void
ui_outgoing_private_msg(const char * const fulljid, const char * const message) 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_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(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_outgoing_private_msg(const char * const fulljid, const char * const message);
void ui_room_join(const char * const roomjid, gboolean focus); 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_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(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_outgoing_private_msg(const char * const fulljid, const char * const message) {}
void ui_room_join(const char * const roomjid, gboolean focus) {} void ui_room_join(const char * const roomjid, gboolean focus) {}