msgid = extract_long(cmdbuf, 0);
extract_token(desired_section, cmdbuf, 1, '|', sizeof desired_section);
- safestrncpy(CC->download_desired_section, desired_section,
- sizeof CC->download_desired_section);
+ safestrncpy(CC->download_desired_section, desired_section, sizeof CC->download_desired_section);
CtdlOutputMsg(msgid, MT_SPEW_SECTION, 0, 1, 1, NULL, 0, NULL, NULL, NULL);
}
sizeof errmsg,
NULL,
POST_LOGGED_IN,
- (!IsEmptyStr(references)) /* is this a reply? or a top-level post? */
+ (!IsEmptyStr(references)) // is this a reply? or a top-level post?
);
if (err) {
cprintf("%d %s\n", err, errmsg);
return;
}
- /* Recipient required, but none were specified */
+ // Recipient required, but none were specified
if ( (valid_to->num_error < 0) && (valid_cc->num_error < 0) && (valid_bcc->num_error < 0) ) {
free_recipients(valid_to);
free_recipients(valid_cc);
}
- /* Is this a room which has anonymous-only or anonymous-option? */
+ // Is this a room which has anonymous-only or anonymous-option?
anonymous = MES_NORMAL;
if (CC->room.QRflags & QR_ANONONLY) {
anonymous = MES_ANONONLY;
}
if (CC->room.QRflags & QR_ANONOPT) {
- if (anon_flag == 1) { /* only if the user requested it */
+ if (anon_flag == 1) { // only if the user requested it
anonymous = MES_ANONOPT;
}
}
recp[0] = 0;
}
- /* Recommend to the client that the use of a message subject is
- * strongly recommended in this room, if either the SUBJECTREQ flag
- * is set, or if there is one or more Internet email recipients.
- */
+ // Recommend to the client that the use of a message subject is
+ // strongly recommended in this room, if either the SUBJECTREQ flag
+ // is set, or if there is one or more Internet email recipients.
+
if (CC->room.QRflags2 & QR2_SUBJECTREQ) subject_required = 1;
if ((valid_to) && (valid_to->num_internet > 0)) subject_required = 1;
if ((valid_cc) && (valid_cc->num_internet > 0)) subject_required = 1;
if ((valid_bcc) && (valid_bcc->num_internet > 0)) subject_required = 1;
- /* If we're only checking the validity of the request, return
- * success without creating the message.
- */
+ // If we're only checking the validity of the request, return success without creating the message.
if (post == 0) {
cprintf("%d %s|%d\n", CIT_OK,
((valid_to != NULL) ? valid_to->display_recp : ""),
return;
}
- /* We don't need these anymore because we'll do it differently below */
+ // We don't need these anymore because we'll do it differently below
free_recipients(valid_to);
free_recipients(valid_cc);
free_recipients(valid_bcc);
- /* Read in the message from the client. */
+ // Read in the message from the client.
if (do_confirm) {
cprintf("%d send message\n", START_CHAT_MODE);
}
return;
}
- /*
- * Build our message set to be moved/copied
- */
+ // Build our message set to be moved/copied
msgs = malloc(num_msgs * sizeof(long));
for (i=0; i<num_msgs; ++i) {
extract_token(msgtok, msgset, i, ',', sizeof msgtok);
CtdlGetUser(&CC->user, CC->curr_user);
CtdlRoomAccess(&qtemp, &CC->user, &ra, NULL);
- /* Check for permission to perform this operation.
- * Remember: "CC->room" is source, "qtemp" is target.
- */
+ // Check for permission to perform this operation.
+ // Remember: "CC->room" is source, "qtemp" is target.
permit = 0;
- /* Admins can move/copy */
+ // Admins can move/copy
if (CC->user.axlevel >= AxAideU) permit = 1;
- /* Room aides can move/copy */
+ // Room aides can move/copy
if (CC->user.usernum == CC->room.QRroomaide) permit = 1;
- /* Permit move/copy from personal rooms */
+ // Permit move/copy from personal rooms
if ((CC->room.QRflags & QR_MAILBOX)
&& (qtemp.QRflags & QR_MAILBOX)) permit = 1;
- /* Permit only copy from public to personal room */
- if ( (is_copy)
- && (!(CC->room.QRflags & QR_MAILBOX))
- && (qtemp.QRflags & QR_MAILBOX)) permit = 1;
+ // Permit only copy from public to personal room
+ if ( (is_copy)
+ && (!(CC->room.QRflags & QR_MAILBOX))
+ && (qtemp.QRflags & QR_MAILBOX)
+ ) {
+ permit = 1;
+ }
- /* Permit message removal from collaborative delete rooms */
+ // Permit message removal from collaborative delete rooms
if (CC->room.QRflags2 & QR2_COLLABDEL) permit = 1;
- /* Users allowed to post into the target room may move into it too. */
+ // Users allowed to post into the target room may move into it too.
if ((CC->room.QRflags & QR_MAILBOX) &&
(qtemp.QRflags & UA_POSTALLOWED)) permit = 1;
- /* User must have access to target room */
+ // User must have access to target room
if (!(ra & UA_KNOWN)) permit = 0;
if (!permit) {
return;
}
- /*
- * Build our message set to be moved/copied
- */
+ // Build our message set to be moved/copied
msgs = malloc(num_msgs * sizeof(long));
for (i=0; i<num_msgs; ++i) {
extract_token(msgtok, msgset, i, ',', sizeof msgtok);
msgs[i] = atol(msgtok);
}
- /*
- * Do the copy
- */
+ // Do the copy
err = CtdlSaveMsgPointersInRoom(targ, msgs, num_msgs, 1, NULL, 0);
if (err != 0) {
cprintf("%d Cannot store message(s) in %s: error %d\n",
return;
}
- /* Now delete the message from the source room,
- * if this is a 'move' rather than a 'copy' operation.
- */
+ // Now delete the message from the source room, if this is a 'move' rather than a 'copy' operation.
if (is_copy == 0) {
CtdlDeleteMessages(CC->room.QRname, msgs, num_msgs, "");
}
return rc;
}
-int StrBufStreamTranscode(eStreamType type, IOBuffer *Target, IOBuffer *In, const char* pIn, long pInLen, vStreamT *vStream, int LastChunk, const char **Err)
-{
+int StrBufStreamTranscode(eStreamType type, IOBuffer *Target, IOBuffer *In, const char* pIn, long pInLen, vStreamT *vStream, int LastChunk, const char **Err) {
int rc = 0;
switch (type)
{
case eBase64Encode:
{
- /// TODO
-/*
- // base64_decodestate *state = (base64_decodestate*)vStream;
- long ExpectLen;
-
- if (In != NULL)
- {
- pIn = In->buf;
- pInLen = In->BufUsed;
- }
- if ((In == NULL) || (vStream == NULL))
- return;
-
- ExpectLen = (pInLen / 4) * 3;
-
- if (Target->BufSize - Target->BufUsed < ExpectLen)
- {
- IncreaseBuf(Target, 1, Target->BufUsed + ExpectLen + 1);
- }
-
- //// ExpectLen = base64_encode_block(pIn, pInLen, Target->buf + Target->BufUsed, state);
- Target->BufUsed += ExpectLen;
- Target->buf[Target->BufUsed] = '\0';
-*/
+ // ???
}
break;
case eBase64Decode:
{
-/*
- base64_decodestate *state = (base64_decodestate *)vStream;
- long ExpectLen;
-
- if (In != NULL)
- {
- pIn = In->buf;
- pInLen = In->BufUsed;
- }
- if ((pIn == NULL) || (vStream == NULL))
- return;
-
- ExpectLen = (pInLen / 4) * 3;
-
- if (Target->BufSize - Target->BufUsed < ExpectLen)
- {
- IncreaseBuf(Target, 1, Target->BufUsed + ExpectLen + 1);
- }
-
- ExpectLen = base64_decode_block(pIn, pInLen, Target->buf + Target->BufUsed, state);
- Target->BufUsed += ExpectLen;
- Target->buf[Target->BufUsed] = '\0';
-*/
+ // ???
}
break;
case eZLibEncode:
stream->OutBuf.BufUsed += (chunkavail - stream->zstream.avail_out);
- if (Target &&
- (LastChunk ||
- (stream->OutBuf.BufUsed != org_outbuf_len)
- ))
- {
+ if (Target && (LastChunk || (stream->OutBuf.BufUsed != org_outbuf_len))) {
iSwapBuffers(Target->Buf, &stream->OutBuf);
}
- if (stream->zstream.avail_in == 0)
- {
+ if (stream->zstream.avail_in == 0) {
FlushStrBuf(In->Buf);
In->ReadWritePointer = NULL;
}
- else
- {
- if (stream->zstream.avail_in < 64)
- {
+ else {
+ if (stream->zstream.avail_in < 64) {
memmove(In->Buf->buf,
In->Buf->buf + In->Buf->BufUsed - stream->zstream.avail_in,
stream->zstream.avail_in);
In->Buf->BufUsed = stream->zstream.avail_in;
In->Buf->buf[In->Buf->BufUsed] = '\0';
}
- else
- {
-
- In->ReadWritePointer = In->Buf->buf +
- (In->Buf->BufUsed - stream->zstream.avail_in);
+ else {
+ In->ReadWritePointer = In->Buf->buf + (In->Buf->BufUsed - stream->zstream.avail_in);
}
}
rc = (LastChunk && (err != Z_FINISH));
int err;
if ((stream->zstream.avail_out != 0) && (stream->zstream.next_in != NULL)) {
- if (In->ReadWritePointer != NULL)
- {
+ if (In->ReadWritePointer != NULL) {
stream->zstream.next_in = (Bytef *) In->ReadWritePointer;
- stream->zstream.avail_in = (uInt) In->Buf->BufUsed -
- (In->ReadWritePointer - In->Buf->buf);
+ stream->zstream.avail_in = (uInt) In->Buf->BufUsed - (In->ReadWritePointer - In->Buf->buf);
}
- else
- {
+ else {
stream->zstream.next_in = (Bytef *) In->Buf->buf;
stream->zstream.avail_in = (uInt) In->Buf->BufUsed;
}
if (Target) iSwapBuffers(Target->Buf, &stream->OutBuf);
- if (stream->zstream.avail_in == 0)
- {
+ if (stream->zstream.avail_in == 0) {
FlushStrBuf(In->Buf);
In->ReadWritePointer = NULL;
}
- else
- {
- if (stream->zstream.avail_in < 64)
- {
+ else {
+ if (stream->zstream.avail_in < 64) {
memmove(In->Buf->buf,
In->Buf->buf + In->Buf->BufUsed - stream->zstream.avail_in,
stream->zstream.avail_in);
In->Buf->BufUsed = stream->zstream.avail_in;
In->Buf->buf[In->Buf->BufUsed] = '\0';
}
- else
- {
+ else {
- In->ReadWritePointer = In->Buf->buf +
- (In->Buf->BufUsed - stream->zstream.avail_in);
+ In->ReadWritePointer = In->Buf->buf + (In->Buf->BufUsed - stream->zstream.avail_in);
}
}
}
* @brief decode a buffer from base 64 encoding; destroys original
* @param Buf Buffor to transform
*/
-int StrBufDecodeHex(StrBuf *Buf)
-{
+int StrBufDecodeHex(StrBuf *Buf) {
unsigned int ch;
char *pch, *pche, *pchi;