about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-10 14:49:26 -0400
committerJune McEnroe <june@causal.agency>2020-04-10 14:49:26 -0400
commit74125df122a82574b751fefaffe6d76982527a80 (patch)
tree539c73707327d7b12b03288f6cfd9e09ce4810e7
parentUse dataCheck in parsing (diff)
downloadbubger-74125df122a82574b751fefaffe6d76982527a80.tar.gz
bubger-74125df122a82574b751fefaffe6d76982527a80.zip
Move extra atoms into the predefined enum
-rw-r--r--archive.c2
-rw-r--r--export.c12
-rw-r--r--imap.h6
3 files changed, 6 insertions, 14 deletions
diff --git a/archive.c b/archive.c
index 3b7d003..93f8355 100644
--- a/archive.c
+++ b/archive.c
@@ -103,8 +103,6 @@ int main(int argc, char *argv[]) {
 		if (!pass) errx(EX_CONFIG, ENV_PASSWORD " unset");
 	}
 
-	enum Atom AtomThread = atom("THREAD");
-
 	enum {
 		Ready,
 		Login,
diff --git a/export.c b/export.c
index 6e4c7fd..6e3554c 100644
--- a/export.c
+++ b/export.c
@@ -162,19 +162,7 @@ static struct Envelope parseEnvelope(struct List list) {
 	return envelope;
 }
 
-static enum Atom AtomBody;
-static enum Atom AtomEnvelope;
-static enum Atom AtomHeaderFields;
-static enum Atom AtomText;
-static enum Atom AtomUID;
-
 void exportData(struct List items) {
-	if (!AtomBody) AtomBody = atom("BODY");
-	if (!AtomEnvelope) AtomEnvelope = atom("ENVELOPE");
-	if (!AtomHeaderFields) AtomHeaderFields = atom("HEADER.FIELDS");
-	if (!AtomText) AtomText = atom("TEXT");
-	if (!AtomUID) AtomUID = atom("UID");
-
 	uint32_t uid = 0;
 	struct Envelope envelope = {0};
 	char *header = NULL;
diff --git a/imap.h b/imap.h
index a7b4b64..f3ca668 100644
--- a/imap.h
+++ b/imap.h
@@ -52,6 +52,12 @@
 	X(AtomRecent, "RECENT") \
 	X(AtomExpunge, "EXPUNGE") \
 	X(AtomFetch, "FETCH") \
+	X(AtomThread, "THREAD") \
+	X(AtomUID, "UID") \
+	X(AtomEnvelope, "ENVELOPE") \
+	X(AtomBody, "BODY") \
+	X(AtomHeaderFields, "HEADER.FIELDS") \
+	X(AtomText, "TEXT") \
 	X(AtomUntagged, "*")
 
 enum Atom {