]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/xmpp/xmpp_messages.c
Apply patches sugested by Taroe Hong plus some more bugfixes.
[citadel.git] / citadel / modules / xmpp / xmpp_messages.c
index 7992d4de4946e3637c122fbd743aa47a813c2ebb..1f7123aebb9bc0e1382d7c743c7e12ebc6d0c6fa 100644 (file)
@@ -1,15 +1,22 @@
 /*
  * Handle messages sent and received using XMPP (Jabber) protocol
  *
- * Copyright (c) 2007-2014 by Art Cancro
+ * Copyright (c) 2007-2010 by Art Cancro
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 3.
+ * 
+ * 
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
+ *
+ * 
+ * 
+ * 
+ *
  */
 
 #include "sysdep.h"
@@ -90,20 +97,20 @@ void xmpp_output_incoming_messages(void)
 /*
  * Client is sending a message.
  */
-void xmpp_send_message(char *message_to, char *message_body) {
+void xmpp_send_message(StrBuf *message_to, char *message_body) {
        struct CitContext *CCC = CC;
        char *recp = NULL;
        struct CitContext *cptr;
 
        if (message_body == NULL) return;
        if (message_to == NULL) return;
-       if (IsEmptyStr(message_to)) return;
+       if (StrLength(message_to) == 0) return;
        if (!CCC->logged_in) return;
 
        for (cptr = ContextList; cptr != NULL; cptr = cptr->next) {
                if (    (cptr->logged_in)
                        && (cptr->can_receive_im)
-                       && (!strcasecmp(cptr->cs_inet_email, message_to))
+                       && (!strcasecmp(cptr->cs_inet_email, ChrPtr(message_to)))
                ) {
                        recp = cptr->user.fullname;
                }
@@ -115,15 +122,11 @@ void xmpp_send_message(char *message_to, char *message_body) {
 
        free(XMPP->message_body);
        XMPP->message_body = NULL;
-       XMPP->message_to[0] = 0;
        time(&CCC->lastidle);
 }
-
-
 void xmpp_end_message(void *data, const char *supplied_el, const char **attr)
 {
-       safestrncpy(XMPP->message_to, ChrPtr(XMPP->Message.to), sizeof(XMPP->message_to));
-       xmpp_send_message(XMPP->message_to, XMPP->message_body);
+       xmpp_send_message(XMPP->Message.to, XMPP->message_body);
        XMPP->html_tag_level = 0;
 }