+ CtdlMailboxName(configRoomName,
+ sizeof(configRoomName),
+ &user,
+ USERCONFIGROOM);
+ // Fill qrbuf
+ CtdlGetRoom(&qrbuf, configRoomName);
+ /* Do something really, really stoopid here. Raid the room on ourselves,
+ * loop through the messages manually and find it. I don't want
+ * to use a CtdlForEachMessage callback here, as we would be
+ * already in one */
+ cdbfr = cdb_fetch(CDB_MSGLISTS, &qrbuf.QRnumber, sizeof(long));
+ if (cdbfr != NULL) {
+ msglist = (long *) cdbfr->ptr;
+ cdbfr->ptr = NULL;
+ /* CtdlForEachMessage() now owns this memory */
+ num_msgs = cdbfr->len / sizeof(long);
+ cdb_free(cdbfr);
+ } else {
+ syslog(LOG_DEBUG,
+ "extNotify_getConfigMessage: "
+ "No config messages found\n");
+ return eNone; /* No messages at all? No further action. */
+ }
+ for (a = 0; a < num_msgs; ++a) {
+ msg = CtdlFetchMessage(msglist[a], 1);
+ if (msg != NULL) {
+ if ((msg->cm_fields['U'] != NULL) &&
+ (strncasecmp(msg->cm_fields['U'],
+ PAGER_CONFIG_MESSAGE,
+ strlen(PAGER_CONFIG_MESSAGE)) == 0))
+ {
+ break;
+ }
+ CtdlFreeMessage(msg);
+ msg = NULL;
+ }
+ }
+
+ free(msglist);
+ if (msg == NULL)
+ return eNone;
+
+ // Do a simple string search to see if 'funambol' is selected as the
+ // type. This string would be at the very top of the message contents.
+
+ configMsg = msg->cm_fields['M'];
+ msg->cm_fields['M'] = NULL;
+ CtdlFreeMessage(msg);
+
+ /* here we would find the pager number... */
+ pch = strchr(configMsg, '\n');
+ if (pch != NULL)
+ {
+ *pch = '\0';
+ pch ++;
+ }
+
+ /* Check to see if:
+ * 1. The user has configured paging / They have and disabled it
+ * AND 2. There is an external pager program
+ * 3. A Funambol server has been entered
+ *