aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-05-04 01:34:18 +0100
committerJames Booth <boothj5@gmail.com>2015-05-04 01:34:18 +0100
commitaca102f542c53a16b32eaf68c4ee8ff07433eda0 (patch)
tree36d5ccc120540fc91631e70a2cd74f699daab20c /src
parent3dace733d982fdb33670f9a919cd9f46661d7088 (diff)
parentc8eaaa0ce918064a4009f706baac4a975999fc3f (diff)
downloadprofani-tty-aca102f542c53a16b32eaf68c4ee8ff07433eda0.tar.gz
Merge branch 'master' into pgp
Diffstat (limited to 'src')
-rw-r--r--src/command/commands.c14
-rw-r--r--src/event/client_events.c6
-rw-r--r--src/event/client_events.h2
-rw-r--r--src/event/ui_events.c6
-rw-r--r--src/event/ui_events.h1
-rw-r--r--src/ui/core.c19
-rw-r--r--src/ui/ui.h4
7 files changed, 27 insertions, 25 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 4c868d77..a7e89724 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -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:
diff --git a/src/event/client_events.c b/src/event/client_events.c
index 167dfac7..db8f6497 100644
--- a/src/event/client_events.c
+++ b/src/event/client_events.c
@@ -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);
} \ No newline at end of file
diff --git a/src/event/client_events.h b/src/event/client_events.h
index 3685cb2d..a7ecc583 100644
--- a/src/event/client_events.h
+++ b/src/event/client_events.h
@@ -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 \ No newline at end of file
diff --git a/src/event/ui_events.c b/src/event/ui_events.c
index bebffc07..ff1d7273 100644
--- a/src/event/ui_events.c
+++ b/src/event/ui_events.c
@@ -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);
} \ No newline at end of file
diff --git a/src/event/ui_events.h b/src/event/ui_events.h
index b7075e61..3f7fed02 100644
--- a/src/event/ui_events.h
+++ b/src/event/ui_events.h
@@ -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 \ No newline at end of file
diff --git a/src/ui/core.c b/src/ui/core.c
index b4cef52d..8c4d4644 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -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
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 212ed451..c98d45e8 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -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);