Straightn http client generation
[citadel.git] / citadel / modules / extnotify / extnotify_main.c
index 2bdf8f0a67d2be3e7991094803b47faf5dfe070c..3029322950dc79f66fdd7a2909d8911cf31c8c44 100644 (file)
@@ -267,9 +267,9 @@ void process_notify(long NotifyMsgnum, void *usrdata)
        Ctx = (NotifyContext*) usrdata;
 
        msg = CtdlFetchMessage(NotifyMsgnum, 1);
-       if ( msg->cm_fields['W'] != NULL) 
+       if ( msg->cm_fields['2'] != NULL) 
        {
-               Type = extNotify_getConfigMessage(msg->cm_fields['W'], &PagerNo, &FreeMe);
+               Type = extNotify_getConfigMessage(msg->cm_fields['2'], &PagerNo, &FreeMe);
        
                pch = strstr(msg->cm_fields['M'], "msgid|");
                if (pch != NULL) 
@@ -284,13 +284,10 @@ void process_notify(long NotifyMsgnum, void *usrdata)
                                 config.c_funambol_port,
                                 FUNAMBOL_WS);
 
-                       SubC = CloneContext (CC);
-                       SubC->session_specific_data = NULL;// (char*) DupNotifyContext(Ctx);
-                       
                        notify_http_server(remoteurl, 
                                           file_funambol_msg,
                                           strlen(file_funambol_msg),/*GNA*/
-                                          msg->cm_fields['W'], 
+                                          msg->cm_fields['2'], 
                                           msg->cm_fields['I'],
                                           msgnum, 
                                           NULL);
@@ -319,12 +316,10 @@ void process_notify(long NotifyMsgnum, void *usrdata)
                                        FlushStrBuf(FileBuf);
                                memcpy(URLBuf, ChrPtr(URL), StrLength(URL) + 1);
 
-                               SubC = CloneContext (CC);
-                               SubC->session_specific_data = NULL;// (char*) DupNotifyContext(Ctx);
                                notify_http_server(URLBuf, 
                                                   ChrPtr(FileBuf),
                                                   StrLength(FileBuf),
-                                                  msg->cm_fields['W'], 
+                                                  msg->cm_fields['2'], 
                                                   msg->cm_fields['I'],
                                                   msgnum, 
                                                   NULL);
@@ -337,9 +332,9 @@ void process_notify(long NotifyMsgnum, void *usrdata)
                        int commandSiz;
                        char *command;
 
-                       commandSiz = sizeof(config.c_pager_program) + strlen(PagerNo) + strlen(msg->cm_fields['W']) + 5;
+                       commandSiz = sizeof(config.c_pager_program) + strlen(PagerNo) + strlen(msg->cm_fields['2']) + 5;
                        command = malloc(commandSiz);
-                       snprintf(command, commandSiz, "%s %s -u %s", config.c_pager_program, PagerNo, msg->cm_fields['W']);
+                       snprintf(command, commandSiz, "%s %s -u %s", config.c_pager_program, PagerNo, msg->cm_fields['2']);
                        system(command);
                        free(command);
                }
@@ -371,7 +366,6 @@ void do_extnotify_queue(void)
         * don't really require extremely fine granularity here, we'll do it
         * with a static variable instead.
         */
-
        if (IsEmptyStr(config.c_pager_program) && 
            IsEmptyStr(config.c_funambol_host))
        {
@@ -382,6 +376,8 @@ void do_extnotify_queue(void)
        if (doing_queue) return;
        doing_queue = 1;
 
+       become_session(&extnotify_queue_CC);
+
        pthread_setspecific(MyConKey, (void *)&extnotify_queue_CC);
 
        /*
@@ -447,6 +443,6 @@ CTDL_MODULE_INIT(extnotify)
                create_extnotify_queue();
                CtdlRegisterSessionHook(do_extnotify_queue, EVT_TIMER);
        }
-       /* return our Subversion id for the Log */
+       /* return our module name for the log */
         return "extnotify";
 }