aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-12-22 00:01:43 +0000
committerJames Booth <boothj5@gmail.com>2014-12-22 00:01:43 +0000
commit86dc29d8e896c70f4adfee90651ebfa9317d31dc (patch)
tree324d50acf132cdb973c3590fd79af10b10aee9c0 /src/command
parentd5dee1632dd6e68a616a748456a880ea05983b3e (diff)
downloadprofani-tty-86dc29d8e896c70f4adfee90651ebfa9317d31dc.tar.gz
Removed functions from window.c
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c2
-rw-r--r--src/command/commands.c14
2 files changed, 11 insertions, 5 deletions
diff --git a/src/command/command.c b/src/command/command.c
index d00b1896..07a2d009 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1794,7 +1794,7 @@ cmd_execute_default(const char * inp)
ProfWin *current = wins_get_current();
ProfChatWin *chatwin = (ProfChatWin*)current;
GString *send_recipient = g_string_new(chatwin->barejid);
- if (current && win_has_chat_resource(current)) {
+ if (current && chatwin->resource) {
g_string_append(send_recipient, "/");
g_string_append(send_recipient, chatwin->resource);
}
diff --git a/src/command/commands.c b/src/command/commands.c
index 31a117fa..c4ad5458 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -37,6 +37,7 @@
#include <string.h>
#include <stdlib.h>
#include <errno.h>
+#include <assert.h>
#include <glib.h>
#ifdef HAVE_LIBOTR
#include <libotr/proto.h>
@@ -1151,10 +1152,15 @@ cmd_msg(gchar **args, struct cmd_help_t help)
}
GString *send_jid = g_string_new(usr_jid);
ProfWin *current = wins_get_current();
- if (current->type == WIN_CHAT && win_has_chat_resource(current)) {
- ProfChatWin *chatwin = (ProfChatWin *)current;
- g_string_append(send_jid, "/");
- g_string_append(send_jid, chatwin->resource);
+
+ // if msg to current recipient, attach resource if set
+ if (current->type == WIN_CHAT) {
+ ProfChatWin *chatwin = (ProfChatWin*)current;
+ assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+ if ((g_strcmp0(chatwin->barejid, usr_jid) == 0) && (chatwin->resource)) {
+ g_string_append(send_jid, "/");
+ g_string_append(send_jid, chatwin->resource);
+ }
}
if (msg != NULL) {