]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/chat/serv_chat.c
* Noticed that when serv_chat.c sets async_waiting to 1, it also checks to see if...
[citadel.git] / citadel / modules / chat / serv_chat.c
index 6b479b06aeb3a3ba2a875ccab3665314a4200238..028f2833b821716f529323d3c2f53e5d51225ddc 100644 (file)
@@ -75,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.
  */
@@ -230,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))
@@ -558,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);
@@ -596,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);
        }
@@ -640,12 +650,7 @@ void add_xmsg_to_context(struct CitContext *ccptr, struct ExpressMessage *newmsg
        /* If the target context is a session which can handle asynchronous
         * messages, go ahead and set the flag for that.
         */
-       if (ccptr->is_async) {
-               ccptr->async_waiting = 1;
-               if (ccptr->state == CON_IDLE) {
-                       ccptr->state = CON_READY;
-               }
-       }
+       set_async_waiting(ccptr);
 }