2 * Edits a users push email settings
3 * Author: Mathew McBride <matt@mcbridematt.dhs.org>
7 void display_pushemail(void)
12 long vector[8] = {8, 0, 0, 1, 2, 3, 4, 5};
13 WCTemplputParams SubTP;
16 memset(&SubTP, 0, sizeof(WCTemplputParams));
17 SubTP.Filter.ContextType = CTX_LONGVECTOR;
18 SubTP.Context = &vector;
21 /* Find any existing settings*/
23 memset(&Room, 0, sizeof(folder));
24 if (goto_config_room(Buf, &Room) == 0) {
26 serv_puts("MSGS ALL|0|1");
27 StrBuf_ServGetln(Buf);
28 if (GetServerStatus(Buf, NULL) == 8) {
29 serv_puts("subj|__ Push email settings __");
32 StrBuf_ServGetln(Buf)) {
33 if ( (StrLength(Buf)==3) &&
34 !strcmp(ChrPtr(Buf), "000")) {
42 serv_printf("MSG0 %d", msgnum);
43 StrBuf_ServGetln(Buf);
44 if (GetServerStatus(Buf, NULL) == 1) {
48 StrBuf_ServGetln(Buf)) {
49 if (( (StrLength(Buf)==3) &&
50 !strcmp(ChrPtr(Buf), "000"))||
51 ((StrLength(Buf)==4) &&
52 !strcmp(ChrPtr(Buf), "text")))
58 if (!strcmp(ChrPtr(Buf), "text")) {
61 StrBuf_ServGetln(Buf)) {
62 if ( (StrLength(Buf)==3) &&
63 !strcmp(ChrPtr(Buf), "000")) {
67 if (strncasecmp(ChrPtr(Buf), "none", 4) == 0) {
69 } else if (strncasecmp(ChrPtr(Buf), "textmessage", 11) == 0) {
72 } else if (strncasecmp(ChrPtr(Buf), "funambol", 8) == 0) {
74 } else if (strncasecmp(ChrPtr(Buf), "httpmessage", 12) == 0) {
77 strncpy(mobnum, ChrPtr(Buf), 20);
84 serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
85 StrBuf_ServGetln(Buf);
86 GetServerStatus(Buf, NULL);
89 output_headers(1, 1, 2, 0, 0, 0);
90 DoTemplate(HKEY("prefs_pushemail"), NULL, &SubTP);
95 void save_pushemail(void)
102 char *pushsetting = bstr("pushsetting");
105 if (strncasecmp(pushsetting, "textmessage", 11) == 0) {
106 sms = bstr("user_sms_number");
109 if (goto_config_room(Buf, &Room) != 0) {
112 return; /* oh well. */
116 serv_puts("MSGS ALL|0|1");
117 StrBuf_ServGetln(Buf);
118 if (GetServerStatus(Buf, NULL) == 8) {
119 serv_puts("subj|__ Push email settings __");
122 printf("Junk in save_pushemail buffer!: %s\n", buf);
128 StrBuf_ServGetln(Buf)) {
129 if ( (StrLength(Buf)==3) &&
130 !strcmp(ChrPtr(Buf), "000")) {
134 msgnum = StrTol(Buf);
138 serv_printf("DELE %d", msgnum);
139 StrBuf_ServGetln(Buf);
140 GetServerStatus(Buf, NULL);
143 serv_printf("ENT0 1||0|1|__ Push email settings __|");
144 StrBuf_ServGetln(Buf);
145 if (GetServerStatus(Buf, NULL) == 4) {
146 serv_puts(pushsetting);
154 /** Go back to the room we're supposed to be in */
155 serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
156 StrBuf_ServGetln(Buf);
157 GetServerStatus(Buf, NULL);
158 http_redirect("display_pushemail");
166 WebcitAddUrlHandler(HKEY("display_pushemail"), "", 0, display_pushemail, 0);
167 WebcitAddUrlHandler(HKEY("save_pushemail"), "", 0, save_pushemail, 0);