aboutsummaryrefslogtreecommitdiffstats
path: root/uid.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-10-24 20:41:57 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-10-24 20:41:57 +0000
commita5c5ce437bce689c08dabdbcd1107f3d0175539d (patch)
treefa0e59dcd9d5aad39333910f0856e90aed4c0306 /uid.c
parentc3d362f9c8a1dea65918ec84e72de1555992adc0 (diff)
downloadfetchmail-a5c5ce437bce689c08dabdbcd1107f3d0175539d.tar.gz
fetchmail-a5c5ce437bce689c08dabdbcd1107f3d0175539d.tar.bz2
fetchmail-a5c5ce437bce689c08dabdbcd1107f3d0175539d.zip
Support for multidrop mailboxes.
svn path=/trunk/; revision=374
Diffstat (limited to 'uid.c')
-rw-r--r--uid.c65
1 files changed, 62 insertions, 3 deletions
diff --git a/uid.c b/uid.c
index ad043af6..8ad4215f 100644
--- a/uid.c
+++ b/uid.c
@@ -110,7 +110,7 @@ char *str;
struct idlist *new;
new = (struct idlist *)xmalloc(sizeof(struct idlist));
- new->num = num;
+ new->val.num = num;
new->id = xstrdup(str);
new->next = *idl;
*idl = new;
@@ -129,6 +129,39 @@ struct idlist **idl;
*idl = (struct idlist *)NULL;
}
+void save_id_pair(idl, str1, str2)
+/* save an ID pair on the given list */
+struct idlist **idl;
+char *str1, *str2;
+{
+ struct idlist *new;
+
+ new = (struct idlist *)xmalloc(sizeof(struct idlist));
+ new->id = xstrdup(str1);
+ if (str2)
+ new->val.id2 = xstrdup(str2);
+ else
+ new->val.id2 = (char *)NULL;
+ new->next = *idl;
+ *idl = new;
+}
+
+#ifdef __UNUSED__
+void free_idpair_list(idl)
+/* free the given ID pair list */
+struct idlist **idl;
+{
+ if (*idl == (struct idlist *)NULL)
+ return;
+
+ free_idpair_list(&(*idl)->next);
+ free ((*idl)->id);
+ free ((*idl)->val.id2);
+ free(*idl);
+ *idl = (struct idlist *)NULL;
+}
+#endif
+
int uid_in_list(idl, str)
/* is a given ID in the given list? */
struct idlist **idl;
@@ -149,12 +182,25 @@ int number;
{
if (*idl == (struct idlist *) 0)
return((char *) 0);
- else if (number == (*idl)->num)
+ else if (number == (*idl)->val.num)
return((*idl)->id);
else
return(uid_find(&(*idl)->next, number));
}
+char *idpair_find(idl, id)
+/* return the id of the given number in the given list. */
+struct idlist **idl;
+char *id;
+{
+ if (*idl == (struct idlist *) 0)
+ return((char *) 0);
+ else if (strcmp(id, (*idl)->id))
+ return((*idl)->val.id2 ? (*idl)->val.id2 : (*idl)->id);
+ else
+ return(idpair_find(&(*idl)->next, id));
+}
+
int delete_uid(idl, num)
/* delete given message from given list */
struct idlist **idl;
@@ -162,7 +208,7 @@ int num;
{
if (*idl == (struct idlist *)NULL)
return(0);
- else if ((*idl)->num == num)
+ else if ((*idl)->val.num == num)
{
struct idlist *next = (*idl)->next;
@@ -176,6 +222,19 @@ int num;
return(0);
}
+void append_uid_list(idl, nidl)
+/* append nidl to idl (does not copy *) */
+struct idlist **idl;
+struct idlist **nidl;
+{
+ if ((*idl) == (struct idlist *)NULL)
+ *idl = *nidl;
+ else if ((*idl)->next == (struct idlist *)NULL)
+ (*idl)->next = *nidl;
+ else
+ append_uid_list(&(*idl)->next, nidl);
+}
+
void update_uid_lists(hostp)
/* perform end-of-query actions on UID lists */
struct hostrec *hostp;