jmap/jmmail.c

branch
dav-2
changeset 928
57167625bfdd
parent 927
0bcf3d69b37a
--- a/jmap/jmmail.c	Fri Jul 10 17:56:21 2026 +0200
+++ b/jmap/jmmail.c	Sat Jul 11 20:57:23 2026 +0200
@@ -105,13 +105,26 @@
     const char *password = argv[3];
     
     JMAPSession *sn = jmap_session_new_with_user(session_url, user, password);
-    curl_easy_setopt(sn->handle, CURLOPT_VERBOSE, 1L);
-    curl_easy_setopt(sn->handle, CURLOPT_STDERR, stderr);
+    //curl_easy_setopt(sn->handle, CURLOPT_VERBOSE, 1L);
+    //curl_easy_setopt(sn->handle, CURLOPT_STDERR, stderr);
     
     CxList *mailboxes = jmap_mailbox_get_list(sn);
     CxIterator i = cxListIterator(mailboxes);
+    JMAPMailBox *inbox = NULL;
     cx_foreach(JMAPMailBox *, mbox, i) {
         printf("{%s}: %s (%s)\n", mbox->id, mbox->name, mbox->role);
+        if(!cx_strcmp(mbox->role, "inbox")) {
+            inbox = mbox;
+        }
+    }
+    
+    if(inbox) {
+        printf("\n");
+        CxList *mails = jmap_mailbox_get_mails(inbox);
+        i = cxListIterator(mails);
+        cx_foreach(JMAPMail *, mail, i) {
+            printf("{%s}: %s\n", mail->id, mail->subject);
+        }
     }
     
     return 0;

mercurial