| 103 const char *session_url = argv[1]; |
103 const char *session_url = argv[1]; |
| 104 const char *user = argv[2]; |
104 const char *user = argv[2]; |
| 105 const char *password = argv[3]; |
105 const char *password = argv[3]; |
| 106 |
106 |
| 107 JMAPSession *sn = jmap_session_new_with_user(session_url, user, password); |
107 JMAPSession *sn = jmap_session_new_with_user(session_url, user, password); |
| 108 curl_easy_setopt(sn->handle, CURLOPT_VERBOSE, 1L); |
108 //curl_easy_setopt(sn->handle, CURLOPT_VERBOSE, 1L); |
| 109 curl_easy_setopt(sn->handle, CURLOPT_STDERR, stderr); |
109 //curl_easy_setopt(sn->handle, CURLOPT_STDERR, stderr); |
| 110 |
110 |
| 111 CxList *mailboxes = jmap_mailbox_get_list(sn); |
111 CxList *mailboxes = jmap_mailbox_get_list(sn); |
| 112 CxIterator i = cxListIterator(mailboxes); |
112 CxIterator i = cxListIterator(mailboxes); |
| |
113 JMAPMailBox *inbox = NULL; |
| 113 cx_foreach(JMAPMailBox *, mbox, i) { |
114 cx_foreach(JMAPMailBox *, mbox, i) { |
| 114 printf("{%s}: %s (%s)\n", mbox->id, mbox->name, mbox->role); |
115 printf("{%s}: %s (%s)\n", mbox->id, mbox->name, mbox->role); |
| |
116 if(!cx_strcmp(mbox->role, "inbox")) { |
| |
117 inbox = mbox; |
| |
118 } |
| |
119 } |
| |
120 |
| |
121 if(inbox) { |
| |
122 printf("\n"); |
| |
123 CxList *mails = jmap_mailbox_get_mails(inbox); |
| |
124 i = cxListIterator(mails); |
| |
125 cx_foreach(JMAPMail *, mail, i) { |
| |
126 printf("{%s}: %s\n", mail->id, mail->subject); |
| |
127 } |
| 115 } |
128 } |
| 116 |
129 |
| 117 return 0; |
130 return 0; |
| 118 } |
131 } |