44 |
#include <mailutils/attribute.h> |
#include <mailutils/attribute.h> |
45 |
#include <mailutils/debug.h> |
#include <mailutils/debug.h> |
46 |
#include <mailutils/error.h> |
#include <mailutils/error.h> |
47 |
|
#include <mailutils/errno.h> |
48 |
#include <mailutils/header.h> |
#include <mailutils/header.h> |
49 |
#include <mailutils/observer.h> |
#include <mailutils/observer.h> |
50 |
#include <mailutils/stream.h> |
#include <mailutils/stream.h> |
1072 |
return 0; |
return 0; |
1073 |
} |
} |
1074 |
|
|
1075 |
|
/* A number consists of one or more digit characters, and represents a |
1076 |
|
numeric value. */ |
1077 |
|
|
1078 |
|
static int |
1079 |
|
imap_digits (f_imap_t f_imap, char **ptr) |
1080 |
|
{ |
1081 |
|
char *start = *ptr; |
1082 |
|
int len; |
1083 |
|
|
1084 |
|
for (++*ptr; **ptr && isdigit(**ptr); ++*ptr) |
1085 |
|
; |
1086 |
|
len = *ptr - start; |
1087 |
|
stream_write (f_imap->string.stream, start, len, |
1088 |
|
f_imap->string.offset, NULL); |
1089 |
|
f_imap->string.offset += len; |
1090 |
|
return 0; |
1091 |
|
} |
1092 |
|
|
1093 |
/* Find which type of string the response is: literal or quoted and let the |
/* Find which type of string the response is: literal or quoted and let the |
1094 |
function fill the string buffer. */ |
function fill the string buffer. */ |
1095 |
static int |
static int |
1112 |
status = imap_literal_string (f_imap, ptr); |
status = imap_literal_string (f_imap, ptr); |
1113 |
} |
} |
1114 |
break; |
break; |
1115 |
|
|
1116 |
case '"': |
case '"': |
1117 |
status = imap_quoted_string (f_imap, ptr); |
status = imap_quoted_string (f_imap, ptr); |
1118 |
break; |
break; |
1119 |
|
|
1120 |
/* NIL */ |
/* NIL */ |
1121 |
case 'N': |
case 'N': |
1122 |
case 'n': |
case 'n': |
1124 |
(*ptr)++; /* I|i */ |
(*ptr)++; /* I|i */ |
1125 |
(*ptr)++; /* L|l */ |
(*ptr)++; /* L|l */ |
1126 |
break; |
break; |
1127 |
|
|
1128 |
default: |
default: |
1129 |
/* Problem. */ |
if (isdigit (**ptr)) |
1130 |
status = 1; |
status = imap_digits (f_imap, ptr); |
1131 |
|
else |
1132 |
|
/* Problem. FIXME: Return a more appropriate error code */ |
1133 |
|
status = MU_ERR_FAILURE; |
1134 |
break; |
break; |
1135 |
} |
} |
1136 |
return status; |
return status; |