set imap->prefix to be the namespace prefix
update version to 0.5 fixed compilation warnings in imap.c
This commit is contained in:
		
							parent
							
								
									bcecbe5eeb
								
							
						
					
					
						commit
						b3672634e5
					
				
					 3 changed files with 10 additions and 19 deletions
				
			
		| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
AC_INIT(isync.h)
 | 
					AC_INIT(isync.h)
 | 
				
			||||||
AM_INIT_AUTOMAKE(isync,0.4)
 | 
					AM_INIT_AUTOMAKE(isync,0.5)
 | 
				
			||||||
AM_PROG_CC_STDC
 | 
					AM_PROG_CC_STDC
 | 
				
			||||||
if test $CC = gcc; then
 | 
					if test $CC = gcc; then
 | 
				
			||||||
	CFLAGS="$CFLAGS -pipe"
 | 
						CFLAGS="$CFLAGS -pipe"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										26
									
								
								imap.c
									
										
									
									
									
								
							
							
						
						
									
										26
									
								
								imap.c
									
										
									
									
									
								
							| 
						 | 
					@ -496,7 +496,6 @@ imap_open (config_t * box, unsigned int minuid, imap_t * imap)
 | 
				
			||||||
    int s;
 | 
					    int s;
 | 
				
			||||||
    struct sockaddr_in sin;
 | 
					    struct sockaddr_in sin;
 | 
				
			||||||
    struct hostent *he;
 | 
					    struct hostent *he;
 | 
				
			||||||
    char *ns_prefix = "";
 | 
					 | 
				
			||||||
    int reuse = 0;
 | 
					    int reuse = 0;
 | 
				
			||||||
#if HAVE_LIBSSL
 | 
					#if HAVE_LIBSSL
 | 
				
			||||||
    int use_ssl = 0;
 | 
					    int use_ssl = 0;
 | 
				
			||||||
| 
						 | 
					@ -542,6 +541,7 @@ imap_open (config_t * box, unsigned int minuid, imap_t * imap)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    imap->box = box;
 | 
					    imap->box = box;
 | 
				
			||||||
    imap->minuid = minuid;
 | 
					    imap->minuid = minuid;
 | 
				
			||||||
 | 
					    imap->prefix = "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!reuse)
 | 
					    if (!reuse)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -696,12 +696,12 @@ imap_open (config_t * box, unsigned int minuid, imap_t * imap)
 | 
				
			||||||
	    is_list (imap->ns_personal->child) &&
 | 
						    is_list (imap->ns_personal->child) &&
 | 
				
			||||||
	    is_atom (imap->ns_personal->child->child))
 | 
						    is_atom (imap->ns_personal->child->child))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	    ns_prefix = imap->ns_personal->child->child->val;
 | 
						    imap->prefix = imap->ns_personal->child->child->val;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fputs ("Selecting mailbox... ", stdout);
 | 
						fputs ("Selecting mailbox... ", stdout);
 | 
				
			||||||
	fflush (stdout);
 | 
						fflush (stdout);
 | 
				
			||||||
	if ((ret = imap_exec (imap, "SELECT \"%s%s\"", ns_prefix, box->box)))
 | 
						if ((ret = imap_exec (imap, "SELECT \"%s%s\"", imap->prefix, box->box)))
 | 
				
			||||||
	    break;
 | 
						    break;
 | 
				
			||||||
	printf ("%d messages, %d recent\n", imap->count, imap->recent);
 | 
						printf ("%d messages, %d recent\n", imap->count, imap->recent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -907,17 +907,7 @@ imap_expunge (imap_t * imap)
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
imap_copy_message (imap_t * imap, unsigned int uid, const char *mailbox)
 | 
					imap_copy_message (imap_t * imap, unsigned int uid, const char *mailbox)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    char *ns_prefix = "";
 | 
					    return imap_exec (imap, "UID COPY %u \"%s%s\"", uid, imap->prefix, mailbox);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* XXX for now assume personal namespace */
 | 
					 | 
				
			||||||
    if (imap->box->use_namespace && is_list (imap->ns_personal) &&
 | 
					 | 
				
			||||||
	is_list (imap->ns_personal->child) &&
 | 
					 | 
				
			||||||
	is_atom (imap->ns_personal->child->child))
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
	ns_prefix = imap->ns_personal->child->child->val;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return imap_exec (imap, "UID COPY %u \"%s%s\"", uid, ns_prefix, mailbox);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
| 
						 | 
					@ -979,8 +969,8 @@ imap_append_message (imap_t * imap, int fd, message_t * msg)
 | 
				
			||||||
		  sizeof (flagstr) - strlen (flagstr), ") ");
 | 
							  sizeof (flagstr) - strlen (flagstr), ") ");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    snprintf (buf, sizeof (buf), "%d APPEND %s %s{%d}\r\n", ++Tag,
 | 
					    send_server (imap->sock, "APPEND %s%s %s{%d}\r\n",
 | 
				
			||||||
	      imap->box->box, flagstr, msg->size + lines);
 | 
						      imap->prefix, imap->box->box, flagstr, msg->size + lines);
 | 
				
			||||||
    socket_write (imap->sock, buf, strlen (buf));
 | 
					    socket_write (imap->sock, buf, strlen (buf));
 | 
				
			||||||
    if (Verbose)
 | 
					    if (Verbose)
 | 
				
			||||||
	fputs (buf, stdout);
 | 
						fputs (buf, stdout);
 | 
				
			||||||
| 
						 | 
					@ -1038,7 +1028,7 @@ imap_append_message (imap_t * imap, int fd, message_t * msg)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	    /* XXX just ignore it for now */
 | 
						    /* XXX just ignore it for now */
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (atoi (arg) != Tag)
 | 
						else if (atoi (arg) != (int) Tag)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	    puts ("wrong tag");
 | 
						    puts ("wrong tag");
 | 
				
			||||||
	    return -1;
 | 
						    return -1;
 | 
				
			||||||
| 
						 | 
					@ -1062,7 +1052,7 @@ imap_append_message (imap_t * imap, int fd, message_t * msg)
 | 
				
			||||||
	    arg = next_arg (&s);
 | 
						    arg = next_arg (&s);
 | 
				
			||||||
	    if (!arg)
 | 
						    if (!arg)
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	    if (atoi (arg) != imap->uidvalidity)
 | 
						    if (atoi (arg) != (int) imap->uidvalidity)
 | 
				
			||||||
	    {
 | 
						    {
 | 
				
			||||||
		puts ("Error, UIDVALIDITY doesn't match APPENDUID");
 | 
							puts ("Error, UIDVALIDITY doesn't match APPENDUID");
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								isync.h
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								isync.h
									
										
									
									
									
								
							| 
						 | 
					@ -125,6 +125,7 @@ typedef struct
 | 
				
			||||||
    buffer_t *buf;		/* input buffer for reading server output */
 | 
					    buffer_t *buf;		/* input buffer for reading server output */
 | 
				
			||||||
    message_t *msgs;		/* list of messages on the server */
 | 
					    message_t *msgs;		/* list of messages on the server */
 | 
				
			||||||
    config_t *box;		/* mailbox to open */
 | 
					    config_t *box;		/* mailbox to open */
 | 
				
			||||||
 | 
					    char *prefix;		/* namespace prefix */
 | 
				
			||||||
    unsigned int deleted;	/* # of deleted messages */
 | 
					    unsigned int deleted;	/* # of deleted messages */
 | 
				
			||||||
    unsigned int uidvalidity;
 | 
					    unsigned int uidvalidity;
 | 
				
			||||||
    unsigned int maxuid;
 | 
					    unsigned int maxuid;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue