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)
{
}
/* Learn about the user and room in question */
- getuser(&CC->user, CC->curr_user);
+ CtdlGetUser(&CC->user, CC->curr_user);
CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
/* Load the message list */
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");
}
/* Bump this user's messages posted counter. */
CtdlLogPrintf(CTDL_DEBUG, "Updating user\n");
- lgetuser(&CCC->user, CCC->curr_user);
+ CtdlGetUserLock(&CCC->user, CCC->curr_user);
CCC->user.posted = CCC->user.posted + 1;
- lputuser(&CCC->user);
+ CtdlPutUserLock(&CCC->user);
/* Decide where bounces need to be delivered */
if ((recps != NULL) && (recps->bounce_to != NULL)) {
'|', sizeof recipient);
CtdlLogPrintf(CTDL_DEBUG, "Delivering private local mail to <%s>\n",
recipient);
- if (getuser(&userbuf, recipient) == 0) {
+ 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;
+void aide_message (char *text, char *subject)
+{
+ quickie_message("Citadel",NULL,NULL,AIDEROOM,text,FMT_CITADEL,subject);
+}
/*
CC->room = tempQR2;
}
- else if (getuser(&tempUS, this_recp) == 0) {
+ else if (CtdlGetUser(&tempUS, this_recp) == 0) {
++ret->num_local;
strcpy(this_recp, tempUS.fullname);
if (!IsEmptyStr(ret->recp_local)) {
}
strcat(ret->recp_local, this_recp);
}
- else if (getuser(&tempUS, this_recp_cooked) == 0) {
+ else if (CtdlGetUser(&tempUS, this_recp_cooked) == 0) {
++ret->num_local;
strcpy(this_recp, tempUS.fullname);
if (!IsEmptyStr(ret->recp_local)) {
return;
}
- getuser(&CC->user, CC->curr_user);
+ CtdlGetUser(&CC->user, CC->curr_user);
CtdlRoomAccess(&qtemp, &CC->user, &ra, NULL);
/* Check for permission to perform this operation.
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));
CTDL_MODULE_INIT(msgbase)
{
- CtdlRegisterProtoHook(cmd_msgs, "MSGS", "Output a list of messages in the current room");
- CtdlRegisterProtoHook(cmd_msg0, "MSG0", "Output a message in plain text format");
- CtdlRegisterProtoHook(cmd_msg2, "MSG2", "Output a message in RFC822 format");
- CtdlRegisterProtoHook(cmd_msg3, "MSG3", "Output a message in raw format (deprecated)");
- CtdlRegisterProtoHook(cmd_msg4, "MSG4", "Output a message in the client's preferred format");
- CtdlRegisterProtoHook(cmd_msgp, "MSGP", "Select preferred format for MSG4 output");
- CtdlRegisterProtoHook(cmd_opna, "OPNA", "Open an attachment for download");
- CtdlRegisterProtoHook(cmd_dlat, "DLAT", "Download an attachment");
- CtdlRegisterProtoHook(cmd_ent0, "ENT0", "Enter a message");
- CtdlRegisterProtoHook(cmd_dele, "DELE", "Delete a message");
- CtdlRegisterProtoHook(cmd_move, "MOVE", "Move or copy a message to another room");
- CtdlRegisterProtoHook(cmd_isme, "ISME", "Determine whether an email address belongs to a user");
+ if (!threading) {
+ CtdlRegisterProtoHook(cmd_msgs, "MSGS", "Output a list of messages in the current room");
+ CtdlRegisterProtoHook(cmd_msg0, "MSG0", "Output a message in plain text format");
+ CtdlRegisterProtoHook(cmd_msg2, "MSG2", "Output a message in RFC822 format");
+ CtdlRegisterProtoHook(cmd_msg3, "MSG3", "Output a message in raw format (deprecated)");
+ CtdlRegisterProtoHook(cmd_msg4, "MSG4", "Output a message in the client's preferred format");
+ CtdlRegisterProtoHook(cmd_msgp, "MSGP", "Select preferred format for MSG4 output");
+ CtdlRegisterProtoHook(cmd_opna, "OPNA", "Open an attachment for download");
+ CtdlRegisterProtoHook(cmd_dlat, "DLAT", "Download an attachment");
+ CtdlRegisterProtoHook(cmd_ent0, "ENT0", "Enter a message");
+ CtdlRegisterProtoHook(cmd_dele, "DELE", "Delete a message");
+ CtdlRegisterProtoHook(cmd_move, "MOVE", "Move or copy a message to another room");
+ CtdlRegisterProtoHook(cmd_isme, "ISME", "Determine whether an email address belongs to a user");
+ }
/* return our Subversion id for the Log */
return "$Id$";