cmd.c
changeset 4 e305d7e562c4
parent 0 72ffcc3c584e
child 5 1b3263c96cbe
equal deleted inserted replaced
3:c0c84518b242 4:e305d7e562c4
    89 				while (sent < written) {
    89 				while (sent < written) {
    90 					gint      crypted;
    90 					gint      crypted;
    91 					gpointer  xep184  = NULL;
    91 					gpointer  xep184  = NULL;
    92 					gsize     len     = 0;
    92 					gsize     len     = 0;
    93 					gchar    *bbuf    = NULL;
    93 					gchar    *bbuf    = NULL;
       
    94 					int       type    = roster_find (cb->jid, jidsearch, ROSTER_TYPE_ROOM) ? ROSTER_TYPE_ROOM : ROSTER_TYPE_USER;
    94 
    95 
    95 					if (written - sent > HBB_BLOCKSIZE) {
    96 					if (written - sent > HBB_BLOCKSIZE) {
    96 						gchar *c = utf8 + sent + HBB_BLOCKSIZE;
    97 						gchar *c = utf8 + sent + HBB_BLOCKSIZE;
    97 						c = g_utf8_find_prev_char (utf8 + sent, c);
    98 						c = g_utf8_find_prev_char (utf8 + sent, c);
    98 
    99 
   104 						len  = c - utf8 - sent;
   105 						len  = c - utf8 - sent;
   105 						bbuf = g_strndup (utf8 + sent, len);
   106 						bbuf = g_strndup (utf8 + sent, len);
   106 					}
   107 					}
   107 
   108 
   108 					// XXX add command/sequence number as title?
   109 					// XXX add command/sequence number as title?
   109 					xmpp_send_msg (cb->jid, len ? bbuf : (utf8 + sent), ROSTER_TYPE_USER, NULL, FALSE /* ? */, &crypted, 0, &xep184);
   110 					xmpp_send_msg (cb->jid, len ? bbuf : (utf8 + sent), type, NULL, FALSE /* ? */, &crypted, LM_MESSAGE_SUB_TYPE_NOT_SET, &xep184);
   110 
   111 
   111 					if (crypted == -1) {
   112 					if (crypted == -1) {
   112 
   113 
   113 						scr_LogPrint (LPRINT_LOGNORM, "cmd: Encryption error. Message not sent.");
   114 						scr_LogPrint (LPRINT_LOGNORM, "cmd: Encryption error. Message not sent.");
   114 
   115 
   118 						g_free (bbuf);
   119 						g_free (bbuf);
   119 
   120 
   120 						continue;
   121 						continue;
   121 					}
   122 					}
   122 
   123 
   123 					hk_message_out (cb->jid, NULL, 0, len ? bbuf : (utf8 + sent), crypted, xep184);
   124 					if (type != ROSTER_TYPE_ROOM)
       
   125 						hk_message_out (cb->jid, NULL, 0, len ? bbuf : (utf8 + sent), crypted, xep184);
   124 
   126 
   125 					if (!len)
   127 					if (!len)
   126 						break;
   128 						break;
   127 
   129 
   128 					g_free (bbuf);
   130 					g_free (bbuf);