2 * Edits a users push email settings
3 * Author: Mathew McBride <matt@mcbridematt.dhs.org>
7 void display_pushemail(void) {
14 svput("BOXTITLE", WCS_STRING
, _("Push email and SMS settings"));
16 /* Find any existing settings*/
17 if (goto_config_room() == 0) {
19 serv_puts("MSGS ALL|0|1");
20 serv_getln(buf
, sizeof(buf
));
22 serv_puts("subj|__ Push email settings __");
24 while(serv_getln(buf
, sizeof buf
), strcmp(buf
, "000")) {
30 serv_printf("MSG0 %d", msgnum
);
31 serv_getln(buf
, sizeof buf
);
34 while (serv_getln(buf
, sizeof buf
),
35 (strcmp(buf
, "text") && strcmp(buf
, "000"))) {
37 if (!strcmp(buf
, "text")) {
38 while (serv_getln(buf
, sizeof buf
), strcmp(buf
, "000")) {
39 if (strncasecmp(buf
, "none", 4) == 0) {
41 } else if (strncasecmp(buf
, "textmessage", 11) == 0) {
44 } else if (strncasecmp(buf
, "funambol", 8) == 0) {
47 strncpy(mobnum
, buf
, 20);
55 svput("PUSH_NONE", WCS_STRING
, "checked=\"checked\"");
56 } else if (is_pager
) {
57 svput("PUSH_TEXT", WCS_STRING
, "checked=\"checked\"");
58 svprintf(HKEY("SMSNUM"), WCS_STRING
, "value=\"%s\"", mobnum
);
59 } else if (is_funambol
) {
60 svput("PUSH_FNBL", WCS_STRING
, "checked=\"checked\"");
62 serv_printf("GOTO %s", ChrPtr(WC
->wc_roomname
));
63 serv_getln(buf
, sizeof buf
);
65 output_headers(1, 1, 2, 0, 0, 0);
66 do_template("pushemail", NULL
);
67 /*do_template("endbox"); */
71 void save_pushemail(void) {
74 char *pushsetting
= bstr("pushsetting");
76 if (strncasecmp(pushsetting
, "textmessage", 11) == 0) {
77 sms
= bstr("user_sms_number");
79 if (goto_config_room() != 0) return; /* oh well. */
80 serv_puts("MSGS ALL|0|1");
81 serv_getln(buf
, sizeof buf
);
83 serv_puts("subj|__ Push email settings __");
86 printf("Junk in save_pushemail buffer!: %s\n", buf
);
89 while (serv_getln(buf
, sizeof buf
), strcmp(buf
, "000")) {
94 serv_printf("DELE %d", msgnum
);
95 serv_getln(buf
, sizeof buf
);
98 serv_printf("ENT0 1||0|1|__ Push email settings __|");
99 serv_getln(buf
, sizeof buf
);
101 serv_puts(pushsetting
);
109 /** Go back to the room we're supposed to be in */
110 serv_printf("GOTO %s", ChrPtr(WC
->wc_roomname
));
111 serv_getln(buf
, sizeof buf
);
112 http_redirect("display_pushemail");
119 WebcitAddUrlHandler(HKEY("display_pushemail"), display_pushemail
, 0);
120 WebcitAddUrlHandler(HKEY("save_pushemail"), save_pushemail
, 0);