CtdlFreeMessage(msg);
}
+/*
+ * Back end for the MSGS command: output EUID header.
+ */
+void headers_euid(long msgnum, void *userdata)
+{
+ struct CtdlMessage *msg;
+
+ msg = CtdlFetchMessage(msgnum, 0);
+ if (msg == NULL) {
+ cprintf("%ld||\n", msgnum);
+ return;
+ }
+
+ cprintf("%ld|%s|\n",
+ msgnum,
+ (msg->cm_fields['U'] ? msg->cm_fields['U'] : "")
+ );
+ CtdlFreeMessage(msg);
+}
+
+
+
/* Determine if a given message matches the fields in a message template.
int CtdlForEachMessage(int mode, long ref, char *search_string,
char *content_type,
struct CtdlMessage *compare,
- void (*CallBack) (long, void *),
+ ForEachMsgCallback CallBack,
void *userdata)
{
int i;
int with_template = 0;
struct CtdlMessage *template = NULL;
- int with_headers = 0;
char search_string[1024];
+ ForEachMsgCallback CallBack;
extract_token(which, cmdbuf, 0, '|', sizeof which);
cm_ref = extract_int(cmdbuf, 1);
extract_token(search_string, cmdbuf, 1, '|', sizeof search_string);
with_template = extract_int(cmdbuf, 2);
- with_headers = extract_int(cmdbuf, 3);
+ switch (extract_int(cmdbuf, 3))
+ {
+ default:
+ case MSG_HDRS_BRIEF:
+ CallBack = simple_listing;
+ break;
+ case MSG_HDRS_ALL:
+ CallBack = headers_listing;
+ break;
+ case MSG_HDRS_EUID:
+ CallBack = headers_euid;
+ break;
+ }
strcat(which, " ");
if (!strncasecmp(which, "OLD", 3))
}
CtdlForEachMessage(mode,
- ( (mode == MSGS_SEARCH) ? 0 : cm_ref ),
- ( (mode == MSGS_SEARCH) ? search_string : NULL ),
- NULL,
- template,
- (with_headers ? headers_listing : simple_listing),
- NULL
- );
+ ( (mode == MSGS_SEARCH) ? 0 : cm_ref ),
+ ( (mode == MSGS_SEARCH) ? search_string : NULL ),
+ NULL,
+ template,
+ CallBack,
+ NULL);
if (template != NULL) CtdlFreeMessage(template);
cprintf("000\n");
}
if (CtdlGetUser(&userbuf, recipient) == 0) {
// Add a flag so the Funambol module knows its mail
msg->cm_fields['W'] = strdup(recipient);
- MailboxName(actual_rm, sizeof actual_rm, &userbuf, MAILROOM);
+ CtdlMailboxName(actual_rm, sizeof actual_rm, &userbuf, MAILROOM);
CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 0, msg);
BumpNewMailCounter(userbuf.usernum);
if (!IsEmptyStr(config.c_funambol_host) || !IsEmptyStr(config.c_pager_program)) {
if (collected_addresses != NULL) {
aptr = (struct addresses_to_be_filed *)
malloc(sizeof(struct addresses_to_be_filed));
- MailboxName(actual_rm, sizeof actual_rm,
+ CtdlMailboxName(actual_rm, sizeof actual_rm,
&CCC->user, USERCONTACTSROOM);
aptr->roomname = strdup(actual_rm);
aptr->collected_addresses = collected_addresses;
char *encoded_message = NULL;
if (is_mailbox != NULL) {
- MailboxName(roomname, sizeof roomname, is_mailbox, req_room);
+ CtdlMailboxName(roomname, sizeof roomname, is_mailbox, req_room);
}
else {
safestrncpy(roomname, req_room, sizeof(roomname));