[Pkg-wmaker-commits] [wmbiff] 13/38: indent run
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:03:38 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to tag wmbiff_0_4_16
in repository wmbiff.
commit 2d6a005a7aa19150b5bb902b1a09849a79800be6
Author: bluehal <bluehal>
Date: Wed Apr 16 08:18:32 2003 +0000
indent run
---
wmbiff/Client.h | 6 +-
wmbiff/Imap4Client.c | 104 ++++++++++--------
wmbiff/MessageList.c | 290 +++++++++++++++++++++++++++------------------------
wmbiff/MessageList.h | 6 +-
wmbiff/tlsComm.c | 112 ++++++++++----------
wmbiff/wmbiff.c | 84 ++++++++-------
6 files changed, 322 insertions(+), 280 deletions(-)
diff --git a/wmbiff/Client.h b/wmbiff/Client.h
index acc5020..062d2c5 100644
--- a/wmbiff/Client.h
+++ b/wmbiff/Client.h
@@ -1,11 +1,11 @@
-/* $Id: Client.h,v 1.31 2003/04/16 08:16:48 bluehal Exp $ */
+/* $Id: Client.h,v 1.32 2003/04/16 08:18:32 bluehal Exp $ */
/* Author : Scott Holden ( scotth at thezone.net )
Modified : Yong-iL Joh ( tolkien at mizi.com )
Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
*
* Email Checker Pop3/Imap4/Licq/Gicu/mbox/maildir/finger
*
- * Last Updated : $Date: 2003/04/16 08:16:48 $
+ * Last Updated : $Date: 2003/04/16 08:18:32 $
*
*/
@@ -73,7 +73,7 @@ typedef struct _mbox_t {
} u;
int (*checkMail) ( /*@notnull@ */ Pop3);
- struct msglst *(*getHeaders) ( /*@notnull@ */ Pop3);
+ struct msglst *(*getHeaders) ( /*@notnull@ */ Pop3);
time_t prevtime;
time_t prevfetch_time;
diff --git a/wmbiff/Imap4Client.c b/wmbiff/Imap4Client.c
index 75659d0..8632a4d 100644
--- a/wmbiff/Imap4Client.c
+++ b/wmbiff/Imap4Client.c
@@ -283,7 +283,7 @@ int imap_checkmail( /*@notnull@ */ Pop3 pc)
/* recover connection state from the cache */
struct connection_state *scs = state_for_pcu(pc);
char buf[BUF_SIZE];
- static int command_id;
+ static int command_id;
/* if it's not in the cache, try to open */
if (scs == NULL) {
@@ -302,8 +302,9 @@ int imap_checkmail( /*@notnull@ */ Pop3 pc)
}
/* if we've got it by now, try the status query */
- command_id ++;
- tlscomm_printf(scs, "a%03d STATUS %s (MESSAGES UNSEEN)\r\n", command_id % 1000, pc->path);
+ command_id++;
+ tlscomm_printf(scs, "a%03d STATUS %s (MESSAGES UNSEEN)\r\n",
+ command_id % 1000, pc->path);
if (tlscomm_expect(scs, "* STATUS", buf, 127) != 0) {
/* a valid response? */
// doesn't support spaces: (void) sscanf(buf, "* STATUS %*s (MESSAGES %d UNSEEN %d)",
@@ -323,25 +324,29 @@ int imap_checkmail( /*@notnull@ */ Pop3 pc)
struct msglst *imap_getHeaders( /*@notnull@ */ Pop3 pc)
{
struct connection_state *scs = state_for_pcu(pc);
- struct msglst *message_list;
- char *msgid;
+ struct msglst *message_list;
+ char *msgid;
char buf[BUF_SIZE];
if (scs == NULL) {
(void) imap_open(pc);
scs = state_for_pcu(pc);
}
- if (scs == NULL) { return NULL; }
- if (tlscomm_is_blacklisted(scs) != 0) { return NULL; }
+ if (scs == NULL) {
+ return NULL;
+ }
+ if (tlscomm_is_blacklisted(scs) != 0) {
+ return NULL;
+ }
- IMAP_DM(pc, DEBUG_INFO, "working headers\n");
+ IMAP_DM(pc, DEBUG_INFO, "working headers\n");
tlscomm_printf(scs, "a004 EXAMINE %s\r\n", pc->path);
if (tlscomm_expect(scs, "a004 OK", buf, 127) == 0) {
tlscomm_close(unbind(scs));
return NULL;
}
- IMAP_DM(pc, DEBUG_INFO, "examine ok\n");
+ IMAP_DM(pc, DEBUG_INFO, "examine ok\n");
/* if we've got it by now, try the status query */
tlscomm_printf(scs, "a005 SEARCH UNSEEN\r\n");
@@ -349,43 +354,50 @@ struct msglst *imap_getHeaders( /*@notnull@ */ Pop3 pc)
tlscomm_close(unbind(scs));
return NULL;
}
- IMAP_DM(pc, DEBUG_INFO, "search: %s", buf);
- if(strlen(buf) < 9) return NULL; /* search turned up nothing */
- msgid = strtok(buf+9, " \r\n");
- message_list = NULL;
- /* the isdigit cruft is to deal with EOL */
- if(msgid != NULL && isdigit(msgid[0])) do {
- struct msglst *m = malloc(sizeof(struct msglst));
- char hdrbuf[128];
- tlscomm_printf(scs, "a04 FETCH %s (FLAGS "
- "BODY[HEADER.FIELDS (FROM SUBJECT)])\r\n", msgid);
- if (tlscomm_expect(scs, "* ", hdrbuf, 127)) {
- m->subj[0] = '\0';
- m->from[0] = '\0';
- while(m->subj[0] == '\0' || m->from[0] == '\0') {
- if (tlscomm_expect(scs, "", hdrbuf, 127)) {
- if (strncmp(hdrbuf, "Subject:", 8) == 0) {
- strncpy(m->subj, hdrbuf+9, SUBJ_LEN-1);
- m->subj[SUBJ_LEN-1] = '\0';
- } else if (strncmp(hdrbuf, "From: ", 5) == 0) {
- strncpy(m->from, hdrbuf+6, FROM_LEN-1);
- m->from[FROM_LEN-1] = '\0';
- }
- } else {
- IMAP_DM(pc, DEBUG_ERROR, "timedout looking for headers.: %s", hdrbuf);
- }
- }
- IMAP_DM(pc, DEBUG_INFO, "From: '%s' Subj: '%s'\n", m->from, m->subj);
- m->next = message_list;
- message_list = m;
- } else {
- IMAP_DM(pc, DEBUG_ERROR, "error fetching: %s", hdrbuf);
- }
- } while((msgid = strtok(NULL, " \r\n")) != NULL && isdigit(msgid[0]));
-
- tlscomm_printf(scs, "a06 CLOSE\r\n" ); /* return to polling state */
- /* may be unneeded tlscomm_expect(scs, "a06 OK CLOSE\r\n" ); see if it worked? */
- IMAP_DM(pc, DEBUG_INFO, "worked headers\n");
+ IMAP_DM(pc, DEBUG_INFO, "search: %s", buf);
+ if (strlen(buf) < 9)
+ return NULL; /* search turned up nothing */
+ msgid = strtok(buf + 9, " \r\n");
+ message_list = NULL;
+ /* the isdigit cruft is to deal with EOL */
+ if (msgid != NULL && isdigit(msgid[0]))
+ do {
+ struct msglst *m = malloc(sizeof(struct msglst));
+ char hdrbuf[128];
+ tlscomm_printf(scs, "a04 FETCH %s (FLAGS "
+ "BODY[HEADER.FIELDS (FROM SUBJECT)])\r\n",
+ msgid);
+ if (tlscomm_expect(scs, "* ", hdrbuf, 127)) {
+ m->subj[0] = '\0';
+ m->from[0] = '\0';
+ while (m->subj[0] == '\0' || m->from[0] == '\0') {
+ if (tlscomm_expect(scs, "", hdrbuf, 127)) {
+ if (strncmp(hdrbuf, "Subject:", 8) == 0) {
+ strncpy(m->subj, hdrbuf + 9, SUBJ_LEN - 1);
+ m->subj[SUBJ_LEN - 1] = '\0';
+ } else if (strncmp(hdrbuf, "From: ", 5) == 0) {
+ strncpy(m->from, hdrbuf + 6, FROM_LEN - 1);
+ m->from[FROM_LEN - 1] = '\0';
+ }
+ } else {
+ IMAP_DM(pc, DEBUG_ERROR,
+ "timedout looking for headers.: %s",
+ hdrbuf);
+ }
+ }
+ IMAP_DM(pc, DEBUG_INFO, "From: '%s' Subj: '%s'\n", m->from,
+ m->subj);
+ m->next = message_list;
+ message_list = m;
+ } else {
+ IMAP_DM(pc, DEBUG_ERROR, "error fetching: %s", hdrbuf);
+ }
+ } while ((msgid = strtok(NULL, " \r\n")) != NULL
+ && isdigit(msgid[0]));
+
+ tlscomm_printf(scs, "a06 CLOSE\r\n"); /* return to polling state */
+ /* may be unneeded tlscomm_expect(scs, "a06 OK CLOSE\r\n" ); see if it worked? */
+ IMAP_DM(pc, DEBUG_INFO, "worked headers\n");
return message_list;
}
diff --git a/wmbiff/MessageList.c b/wmbiff/MessageList.c
index 2441ef6..52c77c6 100644
--- a/wmbiff/MessageList.c
+++ b/wmbiff/MessageList.c
@@ -39,17 +39,19 @@ static int loadFont(const char *fontname)
fn = XLoadQueryFont(display, fontname);
if (fn) {
XSetFont(display, localGC, fn->fid);
- fontHeight = fn->max_bounds.ascent + fn->max_bounds.descent + 2;
+ fontHeight =
+ fn->max_bounds.ascent + fn->max_bounds.descent + 2;
return 0;
} else {
printf("couldn't set font! (%s)\n", fontname);
}
- }
+ }
return -1;
}
-static int flush_expose(Window w) {
+static int flush_expose(Window w)
+{
XEvent dummy;
int i = 0;
@@ -60,151 +62,169 @@ static int flush_expose(Window w) {
}
struct msglst *Headers;
-void msglst_show(Pop3 pc, int x, int y) {
- int maxfrm = 0;
- int maxsubj = 0;
- int limit = 10;
+void msglst_show(Pop3 pc, int x, int y)
+{
+ int maxfrm = 0;
+ int maxsubj = 0;
+ int limit = 10;
XGCValues gcv;
unsigned long gcm;
- /* local gc */
+ /* local gc */
gcm = GCForeground | GCBackground | GCGraphicsExposures;
gcv.foreground = GetColor(foreground);
gcv.background = GetColor(background);
gcv.graphics_exposures = 0;
localGC = XCreateGC(display, Root, gcm, &gcv);
- if(fn == NULL) {
- /* loadFont? or use a proportional instead? mmm. */
- if( loadFont("-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*") < 0) {
- return ;
- }
- }
- if(pc->getHeaders == NULL) {
- DM(pc, DEBUG_INFO, "no getHeaders callback\n");
- return;
- }
- Headers = pc->getHeaders(pc);
- if(Headers == NULL) {
+ if (fn == NULL) {
+ /* loadFont? or use a proportional instead? mmm. */
+ if (loadFont("-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*") < 0) {
+ return;
+ }
+ }
+ if (pc->getHeaders == NULL) {
+ DM(pc, DEBUG_INFO, "no getHeaders callback\n");
+ return;
+ }
+ Headers = pc->getHeaders(pc);
+ if (Headers == NULL) {
#define NO_MSG "no new messages"
- mysizehints.height = 5 + fontHeight;
- mysizehints.width = XTextWidth(fn, NO_MSG, strlen(NO_MSG));
- DM(pc, DEBUG_INFO, "no new messages\n");
- } else {
- struct msglst *h;
- mysizehints.height = 5;
- for(h = Headers; h != NULL && limit > 0; h=h->next, limit--) {
- int frmlen;
- char *c;
- int subjlen;
-
- if((c = index(h->from, '\r')) != NULL) {
- *c = '\0'; /* chomp newlines */
- }
- if((c = index(h->subj, '\r')) != NULL) {
- *c = '\0'; /* chomp newlines */
- }
-
- if((c = index(h->from, '<')) != NULL) {
- *c = '\0'; /* chomp <foo at bar */
- }
- if(h->from[0] == '"') { /* remove "'s */
- for(c=&h->from[1]; *c && *c != '"'; c++) {
- *(c-1) = *c;
- }
- *(c-1) = '\0';
- }
-
-
- subjlen = XTextWidth(fn, h->subj, strlen(h->subj));
- frmlen = XTextWidth(fn, h->from, strlen(h->from));
- if(frmlen > maxfrm) { maxfrm = frmlen; }
- if(subjlen > maxsubj) { maxsubj = subjlen; }
- mysizehints.height += fontHeight;
- }
- mysizehints.width = maxfrm + maxsubj + LEFT_MAR + RIGHT_MAR + COL_SEP;
- }
-
- /* Create a window to hold the stuff */
- mysizehints.flags = USSize | USPosition;
- mysizehints.x = max( x-mysizehints.width, 0);
- mysizehints.y = max( y-mysizehints.height, 0);
-
- newwin = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
- mysizehints.width, mysizehints.height,
- 2, gcv.foreground, gcv.background);
- XSetWMNormalHints(display, newwin, &mysizehints);
- XStoreName(display, newwin, pc->label);
- XSelectInput(display, newwin, ExposureMask);
-
- { /* I confess I don't know what this does or whether it matters */
- XSetWindowAttributes xswa;
- xswa.backing_store = Always;
- xswa.bit_gravity = CenterGravity;
- XChangeWindowAttributes(display, newwin, CWBackingStore | CWBitGravity, &xswa);
- }
-
- XMapWindow(display, newwin);
+ mysizehints.height = 5 + fontHeight;
+ mysizehints.width = XTextWidth(fn, NO_MSG, strlen(NO_MSG));
+ DM(pc, DEBUG_INFO, "no new messages\n");
+ } else {
+ struct msglst *h;
+ mysizehints.height = 5;
+ for (h = Headers; h != NULL && limit > 0; h = h->next, limit--) {
+ int frmlen;
+ char *c;
+ int subjlen;
+
+ if ((c = index(h->from, '\r')) != NULL) {
+ *c = '\0'; /* chomp newlines */
+ }
+ if ((c = index(h->subj, '\r')) != NULL) {
+ *c = '\0'; /* chomp newlines */
+ }
+
+ if ((c = index(h->from, '<')) != NULL) {
+ *c = '\0'; /* chomp <foo at bar */
+ }
+ if (h->from[0] == '"') { /* remove "'s */
+ for (c = &h->from[1]; *c && *c != '"'; c++) {
+ *(c - 1) = *c;
+ }
+ *(c - 1) = '\0';
+ }
+
+
+ subjlen = XTextWidth(fn, h->subj, strlen(h->subj));
+ frmlen = XTextWidth(fn, h->from, strlen(h->from));
+ if (frmlen > maxfrm) {
+ maxfrm = frmlen;
+ }
+ if (subjlen > maxsubj) {
+ maxsubj = subjlen;
+ }
+ mysizehints.height += fontHeight;
+ }
+ mysizehints.width =
+ maxfrm + maxsubj + LEFT_MAR + RIGHT_MAR + COL_SEP;
+ }
+
+ /* Create a window to hold the stuff */
+ mysizehints.flags = USSize | USPosition;
+ mysizehints.x = max(x - mysizehints.width, 0);
+ mysizehints.y = max(y - mysizehints.height, 0);
+
+ newwin =
+ XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
+ mysizehints.width, mysizehints.height, 2,
+ gcv.foreground, gcv.background);
+ XSetWMNormalHints(display, newwin, &mysizehints);
+ XStoreName(display, newwin, pc->label);
+ XSelectInput(display, newwin, ExposureMask);
+
+ { /* I confess I don't know what this does or whether it matters */
+ XSetWindowAttributes xswa;
+ xswa.backing_store = Always;
+ xswa.bit_gravity = CenterGravity;
+ XChangeWindowAttributes(display, newwin,
+ CWBackingStore | CWBitGravity, &xswa);
+ }
+
+ XMapWindow(display, newwin);
}
/* may be called without the window open */
-void msglst_hide(void) {
- if(newwin) {
- struct msglst *n,*h;
- flush_expose(newwin); /* swallow the messages */
- XDestroyWindow(display, newwin);
- // } else {
- // no window fprintf(stderr, "unexpected error destroying msglist window\n");
- for(h = Headers; h != NULL ; ) {
- n = h->next;
- free(h);
- h=n;
- }
- newwin = 0;
- }
+void msglst_hide(void)
+{
+ if (newwin) {
+ struct msglst *n, *h;
+ flush_expose(newwin); /* swallow the messages */
+ XDestroyWindow(display, newwin);
+ // } else {
+ // no window fprintf(stderr, "unexpected error destroying msglist window\n");
+ for (h = Headers; h != NULL;) {
+ n = h->next;
+ free(h);
+ h = n;
+ }
+ newwin = 0;
+ }
}
-void msglst_redraw(void) {
- XEvent dummy;
- unsigned int width, height;
- unsigned int bw, d;
- int x, y;
- Window r;
-
- if(newwin == 0) { return; }
-
- while (XCheckTypedWindowEvent(display, newwin, Expose, &dummy));
- XGetGeometry(display, newwin, &r, &x, &y, &width, &height, &bw, &d);
-
- XSetForeground(display, localGC, GetColor(background));
- XFillRectangle(display, newwin, localGC, 0, 0, width, height);
-
- XSetForeground(display, localGC, GetColor(foreground));
- XSetBackground(display, localGC, GetColor(background));
-
- if(Headers == NULL) {
- XDrawString(display, newwin, localGC, 0, fontHeight,
- NO_MSG, strlen(NO_MSG));
- flush_expose(newwin);
- } else {
- int linenum;
- struct msglst *h;
- int limit = 10;
- int maxfrm = 0;
-
- /* draw the from lines */
- for(h = Headers, linenum = 0; h != NULL && linenum < limit; h=h->next, linenum++) {
- int frm = XTextWidth(fn, h->from, strlen(h->from));
- if(frm > maxfrm) { maxfrm = frm; }
- XDrawString(display, newwin, localGC, LEFT_MAR, (linenum + 1) * fontHeight,
- h->from, strlen(h->from));
- }
-
- /* draw the subject lines */
- for(h = Headers, linenum = 0; h != NULL && linenum < limit; h=h->next, linenum++) {
- XDrawString(display, newwin, localGC, LEFT_MAR + maxfrm + COL_SEP,
- (linenum + 1) * fontHeight,
- h->subj, strlen(h->subj));
- }
- }
+void msglst_redraw(void)
+{
+ XEvent dummy;
+ unsigned int width, height;
+ unsigned int bw, d;
+ int x, y;
+ Window r;
+
+ if (newwin == 0) {
+ return;
+ }
+
+ while (XCheckTypedWindowEvent(display, newwin, Expose, &dummy));
+ XGetGeometry(display, newwin, &r, &x, &y, &width, &height, &bw, &d);
+
+ XSetForeground(display, localGC, GetColor(background));
+ XFillRectangle(display, newwin, localGC, 0, 0, width, height);
+
+ XSetForeground(display, localGC, GetColor(foreground));
+ XSetBackground(display, localGC, GetColor(background));
+
+ if (Headers == NULL) {
+ XDrawString(display, newwin, localGC, 0, fontHeight,
+ NO_MSG, strlen(NO_MSG));
+ flush_expose(newwin);
+ } else {
+ int linenum;
+ struct msglst *h;
+ int limit = 10;
+ int maxfrm = 0;
+
+ /* draw the from lines */
+ for (h = Headers, linenum = 0; h != NULL && linenum < limit;
+ h = h->next, linenum++) {
+ int frm = XTextWidth(fn, h->from, strlen(h->from));
+ if (frm > maxfrm) {
+ maxfrm = frm;
+ }
+ XDrawString(display, newwin, localGC, LEFT_MAR,
+ (linenum + 1) * fontHeight, h->from,
+ strlen(h->from));
+ }
+
+ /* draw the subject lines */
+ for (h = Headers, linenum = 0; h != NULL && linenum < limit;
+ h = h->next, linenum++) {
+ XDrawString(display, newwin, localGC,
+ LEFT_MAR + maxfrm + COL_SEP,
+ (linenum + 1) * fontHeight, h->subj,
+ strlen(h->subj));
+ }
+ }
}
diff --git a/wmbiff/MessageList.h b/wmbiff/MessageList.h
index 796a058..548504e 100644
--- a/wmbiff/MessageList.h
+++ b/wmbiff/MessageList.h
@@ -2,9 +2,9 @@
#define SUBJ_LEN 50
#define FROM_LEN 22
struct msglst {
- struct msglst *next;
- char subj[SUBJ_LEN];
- char from[FROM_LEN];
+ struct msglst *next;
+ char subj[SUBJ_LEN];
+ char from[FROM_LEN];
};
void msglst_show(Pop3 pc, int x, int y);
diff --git a/wmbiff/tlsComm.c b/wmbiff/tlsComm.c
index 55869a8..aaf953c 100644
--- a/wmbiff/tlsComm.c
+++ b/wmbiff/tlsComm.c
@@ -173,55 +173,57 @@ int tlscomm_expect(struct connection_state *scs,
int readbytes = -1;
memset(linebuf, 0, buflen);
TDM(DEBUG_INFO, "%s: expecting: %s\n", scs->name, prefix);
- /* if(scs->unprocessed[0]) {
- TDM(DEBUG_INFO, "%s: buffered: %s\n", scs->name, scs->unprocessed);
- } */
- while (scs->unprocessed[0] != '\0' || wait_for_it(scs->sd, EXPECT_TIMEOUT)) {
- if(scs->unprocessed[0] == '\0') {
+ /* if(scs->unprocessed[0]) {
+ TDM(DEBUG_INFO, "%s: buffered: %s\n", scs->name, scs->unprocessed);
+ } */
+ while (scs->unprocessed[0] != '\0'
+ || wait_for_it(scs->sd, EXPECT_TIMEOUT)) {
+ if (scs->unprocessed[0] == '\0') {
#ifdef USE_GNUTLS
- if (scs->tls_state) {
- /* BUF_SIZE - 1 leaves room for trailing \0 */
- readbytes =
- gnutls_read(scs->tls_state, scs->unprocessed, BUF_SIZE - 1);
- if (readbytes < 0) {
- handle_gnutls_read_error(readbytes, scs);
- return 0;
- }
- } else
+ if (scs->tls_state) {
+ /* BUF_SIZE - 1 leaves room for trailing \0 */
+ readbytes =
+ gnutls_read(scs->tls_state, scs->unprocessed,
+ BUF_SIZE - 1);
+ if (readbytes < 0) {
+ handle_gnutls_read_error(readbytes, scs);
+ return 0;
+ }
+ } else
#endif
- {
- readbytes = read(scs->sd, scs->unprocessed, BUF_SIZE - 1);
- if (readbytes < 0) {
- TDM(DEBUG_ERROR, "%s: error reading: %s\n", scs->name,
- strerror(errno));
- return 0;
- }
- }
- /* force null termination */
- scs->unprocessed[readbytes] = '\0';
- if (readbytes == 0) {
- return 0; /* bummer */
- }
+ {
+ readbytes = read(scs->sd, scs->unprocessed, BUF_SIZE - 1);
+ if (readbytes < 0) {
+ TDM(DEBUG_ERROR, "%s: error reading: %s\n", scs->name,
+ strerror(errno));
+ return 0;
+ }
+ }
+ /* force null termination */
+ scs->unprocessed[readbytes] = '\0';
+ if (readbytes == 0) {
+ return 0; /* bummer */
+ }
} else {
- readbytes = strlen(scs->unprocessed);
- }
- while (readbytes >= prefixlen) {
- int linebytes;
- linebytes =
- getline_from_buffer(scs->unprocessed, linebuf, buflen);
- if (linebytes == 0) {
- readbytes = 0;
- } else {
- readbytes -= linebytes;
- if (strncmp(linebuf, prefix, prefixlen) == 0) {
- TDM(DEBUG_INFO, "%s: got: %*s", scs->name,
- linebytes, linebuf);
- return 1; /* got it! */
- }
- TDM(DEBUG_INFO, "%s: dumped(%d/%d): %.*s", scs->name,
- linebytes, readbytes, linebytes, linebuf);
- }
- }
+ readbytes = strlen(scs->unprocessed);
+ }
+ while (readbytes >= prefixlen) {
+ int linebytes;
+ linebytes =
+ getline_from_buffer(scs->unprocessed, linebuf, buflen);
+ if (linebytes == 0) {
+ readbytes = 0;
+ } else {
+ readbytes -= linebytes;
+ if (strncmp(linebuf, prefix, prefixlen) == 0) {
+ TDM(DEBUG_INFO, "%s: got: %*s", scs->name,
+ linebytes, linebuf);
+ return 1; /* got it! */
+ }
+ TDM(DEBUG_INFO, "%s: dumped(%d/%d): %.*s", scs->name,
+ linebytes, readbytes, linebytes, linebuf);
+ }
+ }
}
if (readbytes == -1) {
TDM(DEBUG_INFO, "%s: timed out while expecting '%s'\n",
@@ -312,7 +314,7 @@ int tls_check_certificate(struct connection_state *scs,
bad_certificate(scs, "server's certificate has been revoked.\n");
} else if (certstat & GNUTLS_CERT_INVALID) {
bad_certificate(scs, "server's certificate is invalid.\n"
- "there may be a problem with the certificate stored in your certfile");
+ "there may be a problem with the certificate stored in your certfile");
} else if (certstat & GNUTLS_CERT_NOT_TRUSTED) {
TDM(DEBUG_INFO, "server's certificate is not trusted.\n");
TDM(DEBUG_INFO,
@@ -321,7 +323,8 @@ int tls_check_certificate(struct connection_state *scs,
/* not checking for not-yet-valid certs... this would make sense
if we weren't just comparing to stored ones */
- cert_list = gnutls_certificate_get_peers(scs->tls_state, &cert_list_size);
+ cert_list =
+ gnutls_certificate_get_peers(scs->tls_state, &cert_list_size);
if (gnutls_x509_extract_certificate_expiration_time(&cert_list[0]) <
time(NULL)) {
@@ -363,7 +366,7 @@ struct connection_state *initialize_gnutls(int sd, char *name, Pop3 pc,
static int gnutls_initialized;
int zok;
struct connection_state *scs = malloc(sizeof(struct connection_state));
- memset(scs, 0, sizeof(struct connection_state)); /* clears the unprocessed buffer */
+ memset(scs, 0, sizeof(struct connection_state)); /* clears the unprocessed buffer */
scs->pc = pc;
@@ -388,9 +391,11 @@ struct connection_state *initialize_gnutls(int sd, char *name, Pop3 pc,
};
/* mutt with gnutls doesn't use kx_srp or kx_anon_dh */
const int mac[] = { GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0 };
- assert(gnutls_protocol_set_priority(scs->tls_state, protocols) == 0);
+ assert(gnutls_protocol_set_priority(scs->tls_state, protocols) ==
+ 0);
assert(gnutls_cipher_set_priority(scs->tls_state, ciphers) == 0);
- assert(gnutls_compression_set_priority(scs->tls_state, compress) == 0);
+ assert(gnutls_compression_set_priority(scs->tls_state, compress) ==
+ 0);
assert(gnutls_kx_set_priority(scs->tls_state, key_exch) == 0);
assert(gnutls_mac_set_priority(scs->tls_state, mac) == 0);
/* no client private key */
@@ -420,7 +425,8 @@ struct connection_state *initialize_gnutls(int sd, char *name, Pop3 pc,
}
}
- gnutls_cred_set(scs->tls_state, GNUTLS_CRD_CERTIFICATE, scs->xcred);
+ gnutls_cred_set(scs->tls_state, GNUTLS_CRD_CERTIFICATE,
+ scs->xcred);
gnutls_transport_set_ptr(scs->tls_state, sd);
do {
zok = gnutls_handshake(scs->tls_state);
@@ -493,7 +499,7 @@ struct connection_state *initialize_unencrypted(int sd,
struct connection_state *ret = malloc(sizeof(struct connection_state));
assert(sd >= 0);
assert(ret != NULL);
- memset(ret, 0, sizeof(struct connection_state)); /* clears the unprocessed buffer */
+ memset(ret, 0, sizeof(struct connection_state)); /* clears the unprocessed buffer */
ret->sd = sd;
ret->name = name;
ret->tls_state = NULL;
diff --git a/wmbiff/wmbiff.c b/wmbiff/wmbiff.c
index 8e2ea06..54146ba 100644
--- a/wmbiff/wmbiff.c
+++ b/wmbiff/wmbiff.c
@@ -1,4 +1,4 @@
-/* $Id: wmbiff.c,v 1.53 2003/04/16 08:14:34 bluehal Exp $ */
+/* $Id: wmbiff.c,v 1.54 2003/04/16 08:18:35 bluehal Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -952,18 +952,18 @@ static void do_biff(int argc, const char **argv)
/* X Events */
while (XPending(display)) {
XEvent Event;
- const char *press_action;
+ const char *press_action;
XNextEvent(display, &Event);
switch (Event.type) {
case Expose:
- if(Event.xany.window != win &&
- Event.xany.window != iconwin ) {
- msglst_redraw();
- } else {
- RedrawWindow();
- }
+ if (Event.xany.window != win &&
+ Event.xany.window != iconwin) {
+ msglst_redraw();
+ } else {
+ RedrawWindow();
+ }
break;
case DestroyNotify:
XCloseDisplay(display);
@@ -972,30 +972,33 @@ static void do_biff(int argc, const char **argv)
case ButtonPress:
but_pressed_region =
CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
- switch (Event.xbutton.button) {
- case 1:
- press_action = mbox[but_pressed_region].action;
- break;
- case 2:
- press_action = mbox[but_pressed_region].button2;
- break;
- case 3:
- press_action = mbox[but_pressed_region].fetchcmd;
- break;
- default:
- press_action = NULL;
- break;
-
- }
- if(press_action && strcmp(press_action, "msglst") == 0) {
- msglst_show(&mbox[but_pressed_region], Event.xbutton.x_root, Event.xbutton.y_root);
- }
+ switch (Event.xbutton.button) {
+ case 1:
+ press_action = mbox[but_pressed_region].action;
+ break;
+ case 2:
+ press_action = mbox[but_pressed_region].button2;
+ break;
+ case 3:
+ press_action = mbox[but_pressed_region].fetchcmd;
+ break;
+ default:
+ press_action = NULL;
+ break;
+
+ }
+ if (press_action && strcmp(press_action, "msglst") == 0) {
+ msglst_show(&mbox[but_pressed_region],
+ Event.xbutton.x_root,
+ Event.xbutton.y_root);
+ }
break;
case ButtonRelease:
- but_released_region = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
+ but_released_region =
+ CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
if (but_pressed_region == (int) i
&& but_pressed_region >= 0) {
- const char *click_action;
+ const char *click_action;
switch (Event.xbutton.button) {
case 1: /* Left mouse-click */
@@ -1004,25 +1007,26 @@ static void do_biff(int argc, const char **argv)
(Event.xbutton.state & ShiftMask)) {
restart_wmbiff(0);
}
- click_action = mbox[but_released_region].action;
+ click_action = mbox[but_released_region].action;
break;
case 2: /* Middle mouse-click */
- click_action = mbox[but_released_region].button2;
- break;
+ click_action = mbox[but_released_region].button2;
+ break;
case 3: /* Right mouse-click */
- click_action = mbox[but_released_region].fetchcmd;
+ click_action = mbox[but_released_region].fetchcmd;
break;
- default:
- click_action = NULL;
- break;
+ default:
+ click_action = NULL;
+ break;
+ }
+ if (click_action != NULL && click_action[0] != '\0'
+ && strcmp(click_action, "msglst")) {
+ (void) execCommand(click_action);
}
- if(click_action != NULL && click_action[0] != '\0' && strcmp(click_action, "msglst")) {
- (void) execCommand(click_action);
- }
}
- /* a button was released, hide the message list if open */
- msglst_hide();
+ /* a button was released, hide the message list if open */
+ msglst_hide();
but_pressed_region = -1;
/* RedrawWindow(); */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git
More information about the Pkg-wmaker-commits
mailing list