Exemplo n.º 1
0
/*
 * This function is called by the main command loop.
 */
void imap_uidsearch(int num_parms, ConstStr *Params) {
	int i;

	if (num_parms < 4) {
		IReply("BAD invalid parameters");
		return;
	}

	for (i = 0; i < IMAP->num_msgs; ++i) {
		IMAP->flags[i] |= IMAP_SELECTED;
	}

	imap_do_search(num_parms-3, &Params[3], 1);
	IReply("OK UID SEARCH completed");
}
Exemplo n.º 2
0
/*
 * Implements the DELETEACL command.
 */
void imap_deleteacl(int num_parms, ConstStr *Params) {

	IReply("BAD not yet implemented FIXME");
	return;
}
Exemplo n.º 3
0
/*
 * Implements the GETACL command.
 */
void imap_getacl(int num_parms, ConstStr *Params) {
	char roomname[ROOMNAMELEN];
	char savedroom[ROOMNAMELEN];
	int msgs, new;
	int ret;
	struct ctdluser temp;
	struct cdbdata *cdbus;
	int ra;
	StrBuf *rights;

	if (num_parms != 3) {
		IReply("BAD usage error");
		return;
	}

	/*
	 * Search for the specified room or folder
	 */
	ret = imap_grabroom(roomname, Params[2].Key, 1);
	if (ret != 0) {
		IReply("NO Invalid mailbox name or access denied");
		return;
	}

	/*
	 * CtdlUserGoto() formally takes us to the desired room.  (If another
	 * folder is selected, save its name so we can return there!!!!!)
	 */
	if (IMAP->selected) {
		strcpy(savedroom, CC->room.QRname);
	}
	CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);

	IAPuts("* ACL ");
	IPutCParamStr(2);

	/*
	 * Traverse the userlist
	 */
	rights = NewStrBuf();
	cdb_rewind(CDB_USERS);
	while (cdbus = cdb_next_item(CDB_USERS), cdbus != NULL) 
	{
		memset(&temp, 0, sizeof temp);
		memcpy(&temp, cdbus->ptr, sizeof temp);
		cdb_free(cdbus);

		CtdlRoomAccess(&CC->room, &temp, &ra, NULL);
		if (!IsEmptyStr(temp.fullname)) {
			imap_acl_flags(rights, ra);
			if (StrLength(rights) > 0) {
				IAPuts(" ");
				IPutStr(temp.fullname, strlen(temp.fullname));
				IAPuts(" ");
				iaputs(SKEY( rights));
			}
		}
	}
	FreeStrBuf(&rights);
	IAPuts("\r\n");

	/*
	 * If another folder is selected, go back to that room so we can resume
	 * our happy day without violent explosions.
	 */
	if (IMAP->selected) {
		CtdlUserGoto(savedroom, 0, 0, &msgs, &new, NULL, NULL);
	}