]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/chat/serv_chat.c
* remove replace part of memfmout(); its not used anymore anyways
[citadel.git] / citadel / modules / chat / serv_chat.c
index 3af65c09fb2370dbfe38be2c3094f405e82172a5..f0f1e7d6c40f4a73d976372cf27f75cf9c28628d 100644 (file)
@@ -4,6 +4,22 @@
  * This module handles all "real time" communication between users.  The
  * modes of communication currently supported are Chat and Paging.
  *
+ * Copyright (c) 1987-2009 by the citadel.org team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  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.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
  */
 #include "sysdep.h"
 #include <stdlib.h>
@@ -38,7 +54,6 @@
 #include "config.h"
 #include "msgbase.h"
 #include "user_ops.h"
-#include "room_ops.h"
 
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
@@ -60,6 +75,16 @@ struct imlog {
 
 struct imlog *imlist = NULL;
 
+
+
+
+/*
+ * FIXME: OMG this module is realy horrible to the rest of the system when accessing contexts.
+ * It pays no regard at all to how long it may have the context list locked for. 
+ * It carries out IO whilst the context list is locked.
+ * I'd recomend disabling this module altogether for the moment.
+ */
+
 /*
  * This function handles the logging of instant messages to disk.
  */
@@ -215,9 +240,9 @@ void allwrite(char *cmdbuf, int flag, char *username)
 }
 
 
-t_context *find_context(char **unstr)
+CitContext *find_context(char **unstr)
 {
-       t_context *t_cc, *found_cc = NULL;
+       CitContext *t_cc, *found_cc = NULL;
        char *name, *tptr;
 
        if ((!*unstr) || (!unstr))
@@ -482,7 +507,7 @@ void cmd_chat(char *argbuf)
                                                        CtdlInvtKick(CC->user.fullname, 0);
 
                                                        /* And return to the Lobby */
-                                                       usergoto(config.c_baseroom, 0, 0, NULL, NULL);
+                                                       CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL);
                                                        return;
                                                }
                                        }
@@ -543,7 +568,7 @@ void cmd_pexp(char *argbuf)
                        cprintf("Message ");
                cprintf("from %s:\n", ptr->sender);
                if (ptr->text != NULL)
-                       memfmout(ptr->text, 0, "\n");
+                       memfmout(ptr->text, "\n");
 
                holdptr = ptr->next;
                if (ptr->text != NULL) free(ptr->text);
@@ -581,7 +606,7 @@ void cmd_gexp(char *argbuf) {
        );
 
        if (ptr->text != NULL) {
-               memfmout(ptr->text, 0, "\n");
+               memfmout(ptr->text, "\n");
                if (ptr->text[strlen(ptr->text)-1] != '\n') cprintf("\n");
                free(ptr->text);
        }
@@ -737,7 +762,7 @@ void cmd_sexp(char *argbuf)
        if (!strcmp(x_msg, "-")) {
                message_sent = PerformXmsgHooks(lun, lem, x_user, "");
                if (message_sent == 0) {
-                       if (getuser(NULL, x_user))
+                       if (CtdlGetUser(NULL, x_user))
                                cprintf("%d '%s' does not exist.\n",
                                                ERROR + NO_SUCH_USER, x_user);
                        else
@@ -775,7 +800,7 @@ void cmd_sexp(char *argbuf)
                                cprintf(" to %d users", message_sent);
                        cprintf(".\n");
                } else {
-                       if (getuser(NULL, x_user))
+                       if (CtdlGetUser(NULL, x_user))
                                cprintf("%d '%s' does not exist.\n",
                                                ERROR + NO_SUCH_USER, x_user);
                        else
@@ -887,20 +912,20 @@ void flush_individual_conversation(struct imlog *im) {
         * prefix will be created.  That's ok because the auto-purger will clean it up later.
         */
        snprintf(roomname, sizeof roomname, "%010ld.%s", im->usernums[1], PAGELOGROOM);
-       create_room(roomname, 5, "", 0, 1, 1, VIEW_BBS);
+       CtdlCreateRoom(roomname, 5, "", 0, 1, 1, VIEW_BBS);
        msgnum = CtdlSubmitMsg(msg, NULL, roomname, 0);
        CtdlFreeMessage(msg);
 
        /* If there is a valid user number in usernums[0], save a copy for them too. */
        if (im->usernums[0] > 0) {
                snprintf(roomname, sizeof roomname, "%010ld.%s", im->usernums[0], PAGELOGROOM);
-               create_room(roomname, 5, "", 0, 1, 1, VIEW_BBS);
+               CtdlCreateRoom(roomname, 5, "", 0, 1, 1, VIEW_BBS);
                CtdlSaveMsgPointerInRoom(roomname, msgnum, 0, NULL);
        }
 
        /* Finally, if we're logging instant messages globally, do that now. */
        if (!IsEmptyStr(config.c_logpages)) {
-               create_room(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
+               CtdlCreateRoom(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
                CtdlSaveMsgPointerInRoom(config.c_logpages, msgnum, 0, NULL);
        }