- // Can Funambol take the message?
- pch = strchr(configMsg, '\n');
- if (*pch == '\n')
- *pch = '\0';
- fnblAllowed = strncasecmp(configMsg, HKEY(FUNAMBOL_CONFIG_TEXT));
- extPagerAllowedHttp = strncasecmp(configMsg, HKEY(PAGER_CONFIG_HTTP));
- extPagerAllowedSystem = strncasecmp(configMsg, HKEY(PAGER_CONFIG_SYSTEM));
- pch = strstr(msg->cm_fields['M'], "msgid|");
- if (pch != NULL)
- msgnum = atol(pch + sizeof("msgid"));
- if (fnblAllowed == 0) {
- char remoteurl[SIZ];
- snprintf(remoteurl, SIZ, "http://%s@%s:%d/%s",
- config.c_funambol_auth,
- config.c_funambol_host,
- config.c_funambol_port,
- FUNAMBOL_WS);
- notify_http_server(remoteurl,
- file_funambol_msg,
- strlen(file_funambol_msg),/*GNA*/
- msg->cm_fields['W'],
- msg->cm_fields['I'],
- msgnum,
- Ctx);
- } else if (extPagerAllowedHttp == 0) {
- int i = 0;
- StrBuf *URL;
- char URLBuf[SIZ];
- StrBuf *File;
- StrBuf *FileBuf = NewStrBuf();
-
- while(1)
+ pch = strstr(msg->cm_fields[eMesageText], "msgid|");
+ if (pch != NULL)
+ msgnum = atol(pch + sizeof("msgid"));
+
+ switch (Type)
+ {
+ case eFunambol:
+ snprintf(remoteurl, SIZ, "http://%s@%s:%d/%s",
+ config.c_funambol_auth,
+ config.c_funambol_host,
+ config.c_funambol_port,
+ FUNAMBOL_WS);
+
+ notify_http_server(remoteurl,
+ file_funambol_msg,
+ strlen(file_funambol_msg),/*GNA*/
+ msg->cm_fields[eExtnotify],
+ msg->cm_fields[emessageId],
+ msgnum,
+ NULL);
+ break;
+ case eHttpMessages:
+ {
+ int i = 0;
+ StrBuf *URL;
+ char URLBuf[SIZ];
+ StrBuf *File;
+ StrBuf *FileBuf = NewStrBuf();
+
+ for (i = 0; i < Ctx->nNotifyHosts; i++)
+ {
+
+ URL = GetNHBuf(i*2, 0, Ctx->NotifyHostList);
+ if (URL==NULL) break;
+ File = GetNHBuf(i*2 + 1, 0,
+ Ctx->NotifyHostList);
+ if (File==NULL) break;
+
+ if (StrLength(File)>0)
+ StrBufPrintf(FileBuf, "%s/%s",
+ ctdl_shared_dir,
+ ChrPtr(File));
+ else
+ FlushStrBuf(FileBuf);
+ memcpy(URLBuf, ChrPtr(URL), StrLength(URL) + 1);
+
+ notify_http_server(URLBuf,
+ ChrPtr(FileBuf),
+ StrLength(FileBuf),
+ msg->cm_fields[eExtnotify],
+ msg->cm_fields[emessageId],
+ msgnum,
+ NULL);
+ }
+ FreeStrBuf(&FileBuf);
+ }
+ break;
+ case eTextMessage: