Fix sending to MUC rooms
authorMyhailo Danylenko <isbear@ukrpost.net>
Wed, 02 Dec 2009 21:05:12 +0200
changeset 4 e305d7e562c4
parent 3 c0c84518b242
child 5 1b3263c96cbe
Fix sending to MUC rooms
cmd.c
--- a/cmd.c	Wed Nov 11 15:28:57 2009 +0200
+++ b/cmd.c	Wed Dec 02 21:05:12 2009 +0200
@@ -91,6 +91,7 @@
 					gpointer  xep184  = NULL;
 					gsize     len     = 0;
 					gchar    *bbuf    = NULL;
+					int       type    = roster_find (cb->jid, jidsearch, ROSTER_TYPE_ROOM) ? ROSTER_TYPE_ROOM : ROSTER_TYPE_USER;
 
 					if (written - sent > HBB_BLOCKSIZE) {
 						gchar *c = utf8 + sent + HBB_BLOCKSIZE;
@@ -106,7 +107,7 @@
 					}
 
 					// XXX add command/sequence number as title?
-					xmpp_send_msg (cb->jid, len ? bbuf : (utf8 + sent), ROSTER_TYPE_USER, NULL, FALSE /* ? */, &crypted, 0, &xep184);
+					xmpp_send_msg (cb->jid, len ? bbuf : (utf8 + sent), type, NULL, FALSE /* ? */, &crypted, LM_MESSAGE_SUB_TYPE_NOT_SET, &xep184);
 
 					if (crypted == -1) {
 
@@ -120,7 +121,8 @@
 						continue;
 					}
 
-					hk_message_out (cb->jid, NULL, 0, len ? bbuf : (utf8 + sent), crypted, xep184);
+					if (type != ROSTER_TYPE_ROOM)
+						hk_message_out (cb->jid, NULL, 0, len ? bbuf : (utf8 + sent), crypted, xep184);
 
 					if (!len)
 						break;