indent -kr -i8 -brf -bbb -fnc -l132 -nce on all of webcit-classic
[citadel.git] / webcit / pushemail.c
index 92fd026b13d5f45fb9975252db923598f4f428d8..e3abeb698c3eeadd4ec39433ff49a168e51af413 100644 (file)
@@ -1,22 +1,22 @@
+
 /*
  * Edits a users push email settings 
  * Author: Mathew McBride <matt@mcbridematt.dhs.org>
  */
 #include "webcit.h"
 
-void display_pushemail(void) 
-{
+void display_pushemail(void) {
        folder Room;
        int Done = 0;
        StrBuf *Buf;
-       long vector[8] = {8, 0, 0, 1, 2, 3, 4, 5};
+       long vector[8] = { 8, 0, 0, 1, 2, 3, 4, 5 };
        WCTemplputParams SubTP;
        char mobnum[20];
 
        StackContext(NULL, &SubTP, &vector, CTX_LONGVECTOR, 0, NULL);
        vector[0] = 16;
 
-       /* Find any existing settings*/
+       /* Find any existing settings */
        Buf = NewStrBuf();
        memset(&Room, 0, sizeof(folder));
        if (goto_config_room(Buf, &Room) == 0) {
@@ -26,10 +26,8 @@ void display_pushemail(void)
                if (GetServerStatus(Buf, NULL) == 8) {
                        serv_puts("subj|__ Push email settings __");
                        serv_puts("000");
-                       while (!Done &&
-                              StrBuf_ServGetln(Buf) >= 0) {
-                               if ( (StrLength(Buf)==3) && 
-                                    !strcmp(ChrPtr(Buf), "000")) {
+                       while (!Done && StrBuf_ServGetln(Buf) >= 0) {
+                               if ((StrLength(Buf) == 3) && !strcmp(ChrPtr(Buf), "000")) {
                                        Done = 1;
                                        break;
                                }
@@ -37,48 +35,47 @@ void display_pushemail(void)
                        }
                }
                if (msgnum > 0L) {
-               serv_printf("MSG0 %d", msgnum);
-               StrBuf_ServGetln(Buf);
-               if (GetServerStatus(Buf, NULL) == 1) {
-                       int i =0;
-                       Done = 0;
-                       while (!Done &&
-                              StrBuf_ServGetln(Buf) >= 0) {
-                               if (( (StrLength(Buf)==3) && 
-                                     !strcmp(ChrPtr(Buf), "000"))||
-                                   ((StrLength(Buf)==4) && 
-                                    !strcmp(ChrPtr(Buf), "text")))
-                               {
-                                       Done = 1;
-                                       break;
-                               }
-                       }
-                       if (!strcmp(ChrPtr(Buf), "text")) {
+                       serv_printf("MSG0 %d", msgnum);
+                       StrBuf_ServGetln(Buf);
+                       if (GetServerStatus(Buf, NULL) == 1) {
+                               int i = 0;
                                Done = 0;
-                               while (!Done &&
-                                      StrBuf_ServGetln(Buf) >= 0) {
-                                       if ( (StrLength(Buf)==3) && 
-                                            !strcmp(ChrPtr(Buf), "000")) {
+                               while (!Done && StrBuf_ServGetln(Buf) >= 0) {
+                                       if (((StrLength(Buf) == 3) &&
+                                            !strcmp(ChrPtr(Buf), "000")) ||
+                                           ((StrLength(Buf) == 4) && !strcmp(ChrPtr(Buf), "text"))) {
                                                Done = 1;
                                                break;
                                        }
-                                       if (strncasecmp(ChrPtr(Buf), "none", 4) == 0) {
-                                               vector[1] = 0;
-                                       } else if (strncasecmp(ChrPtr(Buf), "textmessage", 11) == 0) {
-                                               vector[1] = 1;
-                                               i++;
-                                       } else if (strncasecmp(ChrPtr(Buf), "funambol", 8) == 0) {
-                                               vector[1] = 2;
-                                       } else if (strncasecmp(ChrPtr(Buf), "httpmessage", 12) == 0) {
-                                               vector[1] = 3;
-                                       } else if (i == 1) {
-                                               strncpy(mobnum, ChrPtr(Buf), 20);
-                                               i++;
+                               }
+                               if (!strcmp(ChrPtr(Buf), "text")) {
+                                       Done = 0;
+                                       while (!Done && StrBuf_ServGetln(Buf) >= 0) {
+                                               if ((StrLength(Buf) == 3) && !strcmp(ChrPtr(Buf), "000")) {
+                                                       Done = 1;
+                                                       break;
+                                               }
+                                               if (strncasecmp(ChrPtr(Buf), "none", 4) == 0) {
+                                                       vector[1] = 0;
+                                               }
+                                               else if (strncasecmp(ChrPtr(Buf), "textmessage", 11) == 0) {
+                                                       vector[1] = 1;
+                                                       i++;
+                                               }
+                                               else if (strncasecmp(ChrPtr(Buf), "funambol", 8) == 0) {
+                                                       vector[1] = 2;
+                                               }
+                                               else if (strncasecmp(ChrPtr(Buf), "httpmessage", 12) == 0) {
+                                                       vector[1] = 3;
+                                               }
+                                               else if (i == 1) {
+                                                       strncpy(mobnum, ChrPtr(Buf), 20);
+                                                       i++;
+                                               }
                                        }
-                               }       
+                               }
                        }
                }
-               }
                serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
                StrBuf_ServGetln(Buf);
                GetServerStatus(Buf, NULL);
@@ -91,8 +88,7 @@ void display_pushemail(void)
        FreeStrBuf(&Buf);
 }
 
-void save_pushemail(void) 
-{
+void save_pushemail(void) {
        folder Room;
        int Done = 0;
        StrBuf *Buf;
@@ -109,7 +105,7 @@ void save_pushemail(void)
        if (goto_config_room(Buf, &Room) != 0) {
                FreeStrBuf(&Buf);
                FlushFolder(&Room);
-               return; /* oh well. */
+               return;         /* oh well. */
        }
        FlushFolder(&Room);
 
@@ -118,16 +114,15 @@ void save_pushemail(void)
        if (GetServerStatus(Buf, NULL) == 8) {
                serv_puts("subj|__ Push email settings __");
                serv_puts("000");
-       } else {
+       }
+       else {
                printf("Junk in save_pushemail buffer!: %s\n", buf);
                FreeStrBuf(&Buf);
                return;
        }
 
-       while (!Done &&
-              StrBuf_ServGetln(Buf) >= 0) {
-               if ( (StrLength(Buf)==3) && 
-                    !strcmp(ChrPtr(Buf), "000")) {
+       while (!Done && StrBuf_ServGetln(Buf) >= 0) {
+               if ((StrLength(Buf) == 3) && !strcmp(ChrPtr(Buf), "000")) {
                        Done = 1;
                        break;
                }
@@ -145,8 +140,8 @@ void save_pushemail(void)
        if (GetServerStatus(Buf, NULL) == 4) {
                serv_puts(pushsetting);
                if (sms != NULL) {
-               serv_puts(sms);
-               } 
+                       serv_puts(sms);
+               }
                serv_puts("");
                serv_puts("000");
        }
@@ -159,10 +154,7 @@ void save_pushemail(void)
        FreeStrBuf(&Buf);
 }
 
-void 
-InitModule_PUSHMAIL
-(void)
-{
+void InitModule_PUSHMAIL(void) {
        WebcitAddUrlHandler(HKEY("display_pushemail"), "", 0, display_pushemail, 0);
        WebcitAddUrlHandler(HKEY("save_pushemail"), "", 0, save_pushemail, 0);
 }