Exemple #1
0
void handle_worker_create_mailbox(struct worker_pipe *pipe, struct worker_message *message) {
	struct imap_connection *imap = pipe->data;
	worker_post_message(pipe, WORKER_ACK, message, NULL);
	imap_create(imap, NULL, NULL, (const char *)message->data);
	// TODO: Bubble errors/success up to main thread
	// Would be nice to have a generic transactional flow between threads
	// WORKER_* -> WORKER_ACK -> [process] -> WORKER_{DONE,ERROR}
	// With the original error attached and a hashtable of functions for
	// handling the result (similar to how the IMAP code works)
}
Exemple #2
0
/*
 * Auxiliary function to create a mailbox.
 */
int
create_mailbox(session *ssn, const char *mbox)
{
	int r;
	const char *m;

	m = apply_namespace(mbox, ssn->ns.prefix, ssn->ns.delim);

	if ((r = response_generic(ssn, imap_create(ssn, m))) == -1)
		return -1;

	if (get_option_boolean("subscribe"))
		if (response_generic(ssn, imap_subscribe(ssn, m)) == -1)
			return -1;

	return r;
}
Exemple #3
0
/*
 * Create the specified mailbox.
 */
int
request_create(const char *server, const char *port, const char *user,
    const char *mbox)
{
	int r;
	session *s;
	const char *m;

	if (!(s = session_find(server, port, user)))
		return -1;

	m = apply_namespace(mbox, s->ns.prefix, s->ns.delim);

	if ((r = response_generic(s, imap_create(s, m))) == -1)
		goto fail;

	return r;
fail:
	close_connection(s);
	session_destroy(s);

	return -1;
}
Exemple #4
0
struct minix_d_inode *imap_new_inode(struct super_block *sb, int *rino, struct block **b)
{
	struct minix_d_inode *mdi;
	struct block *block;
	int ino = imap_create(sb);
	if (ino < 0)
		return NULL;
	block = minix_get_block(sb, INODE_BLK(minixsuper(sb), ino));
	if (!block)
		return NULL;
	/* init minix disk inode */
	mdi = BLOCK2INODE(block, ino);
	memset(mdi, 0x0, sizeof(*mdi));
	mdi->i_mode = S_IFREG | 0755;	/* default type: regular file */
	mdi->i_nlinks = 1;
	/* minix disk inode is dirty */
	block->b_dirty = 1;
	/* save return value */
	if (rino)
		*rino = ino;
	if (b)
		*b = block;
	return mdi;
}