1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-30 21:55:24 +00:00

Merge branch 'master' into pgp

This commit is contained in:
James Booth 2015-05-04 01:34:18 +01:00
commit aca102f542
8 changed files with 33 additions and 27 deletions

View File

@ -119,7 +119,7 @@ cmd_execute_default(const char * inp)
case WIN_PRIVATE:
{
ProfPrivateWin *privatewin = wins_get_current_private();
cl_ev_send_priv_msg(privatewin->fulljid, inp);
cl_ev_send_priv_msg(privatewin, inp);
break;
}
case WIN_MUC:
@ -1321,10 +1321,14 @@ cmd_msg(gchar **args, struct cmd_help_t help)
g_string_append(full_jid, "/");
g_string_append(full_jid, usr);
ProfPrivateWin *privwin = wins_get_private(full_jid->str);
if (!privwin) {
privwin = ui_ev_new_private_win(full_jid->str);
}
ui_ev_focus_win((ProfWin*)privwin);
if (msg) {
cl_ev_send_priv_msg(full_jid->str, msg);
} else {
ui_new_private_win(full_jid->str);
cl_ev_send_priv_msg(privwin, msg);
}
g_string_free(full_jid, TRUE);
@ -3160,7 +3164,7 @@ cmd_tiny(gchar **args, struct cmd_help_t help)
case WIN_PRIVATE:
{
ProfPrivateWin *privatewin = wins_get_current_private();
cl_ev_send_priv_msg(privatewin->fulljid, tiny);
cl_ev_send_priv_msg(privatewin, tiny);
break;
}
case WIN_MUC:

View File

@ -82,8 +82,8 @@ cl_ev_send_muc_msg(ProfMucWin *mucwin, const char * const msg)
}
void
cl_ev_send_priv_msg(const char * const fulljid, const char * const msg)
cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char * const msg)
{
message_send_private(fulljid, msg);
ui_outgoing_private_msg(fulljid, msg);
message_send_private(privwin->fulljid, msg);
ui_outgoing_private_msg(privwin, msg);
}

View File

@ -40,6 +40,6 @@ jabber_conn_status_t cl_ev_connect_account(ProfAccount *account);
void cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg);
void cl_ev_send_muc_msg(ProfMucWin *mucwin, const char * const msg);
void cl_ev_send_priv_msg(const char * const fulljid, const char * const msg);
void cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char * const msg);
#endif

View File

@ -47,4 +47,10 @@ ProfChatWin*
ui_ev_new_chat_win(const char * const barejid)
{
return ui_new_chat_win(barejid);
}
ProfPrivateWin*
ui_ev_new_private_win(const char * const fulljid)
{
return ui_new_private_win(fulljid);
}

View File

@ -37,5 +37,6 @@
void ui_ev_focus_win(ProfWin *win);
ProfChatWin* ui_ev_new_chat_win(const char * const barejid);
ProfPrivateWin* ui_ev_new_private_win(const char * const fulljid);
#endif

View File

@ -1273,14 +1273,11 @@ ui_recipient_gone(const char * const barejid, const char * const resource)
}
}
void
ProfPrivateWin*
ui_new_private_win(const char * const fulljid)
{
ProfWin *window = (ProfWin*)wins_get_private(fulljid);
if (!window) {
window = wins_new_private(fulljid);
}
ui_ev_focus_win(window);
ProfWin *window = wins_new_private(fulljid);
return (ProfPrivateWin*)window;
}
void
@ -1357,15 +1354,9 @@ ui_outgoing_chat_msg_carbon(const char * const barejid, const char * const messa
}
void
ui_outgoing_private_msg(const char * const fulljid, const char * const message)
ui_outgoing_private_msg(ProfPrivateWin *privwin, const char * const message)
{
ProfWin *window = (ProfWin*)wins_get_private(fulljid);
if (!window) {
window = wins_new_private(fulljid);
}
win_print(window, '-', NULL, 0, THEME_TEXT_ME, "me", message);
ui_ev_focus_win(window);
win_print((ProfWin*)privwin, '-', NULL, 0, THEME_TEXT_ME, "me", message);
}
void

View File

@ -84,7 +84,7 @@ void ui_handle_otr_error(const char * const barejid, const char * const message)
unsigned long ui_get_idle_time(void);
void ui_reset_idle_time(void);
void ui_new_private_win(const char * const fulljid);
ProfPrivateWin* ui_new_private_win(const char * const fulljid);
ProfChatWin* ui_new_chat_win(const char * const barejid);
void ui_print_system_msg_from_recipient(const char * const barejid, const char *message);
gint ui_unread(void);
@ -122,7 +122,7 @@ void ui_recipient_gone(const char * const barejid, const char * const resource);
void ui_outgoing_chat_msg(ProfChatWin *chatwin, 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(ProfPrivateWin *privwin, const char * const message);
void ui_room_join(const char * const roomjid, gboolean focus);
void ui_switch_to_room(const char * const roomjid);

View File

@ -91,7 +91,11 @@ unsigned long ui_get_idle_time(void)
}
void ui_reset_idle_time(void) {}
void ui_new_private_win(const char * const fulljid) {}
ProfPrivateWin* ui_new_private_win(const char * const fulljid)
{
return NULL;
}
ProfChatWin* ui_new_chat_win(const char * const barejid)
{
return NULL;
@ -192,7 +196,7 @@ void ui_recipient_gone(const char * const barejid, const char * const resource)
void ui_outgoing_chat_msg(ProfChatWin *chatwin, 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(ProfPrivateWin *privwin, const char * const message) {}
void ui_room_join(const char * const roomjid, gboolean focus) {}
void ui_switch_to_room(const char * const roomjid) {}