2 * Edits a users push email settings
3 * Author: Mathew McBride <matt@mcbridematt.dhs.org>
7 void display_pushemail(void)
11 long vector[8] = {8, 0, 0, 1, 2, 3, 4, 5};
12 WCTemplputParams SubTP;
15 memset(&SubTP, 0, sizeof(WCTemplputParams));
16 SubTP.Filter.ContextType = CTX_LONGVECTOR;
17 SubTP.Context = &vector;
20 /* Find any existing settings*/
22 if (goto_config_room(Buf) == 0) {
24 serv_puts("MSGS ALL|0|1");
25 StrBuf_ServGetln(Buf);
26 if (GetServerStatus(Buf, NULL) == 8) {
27 serv_puts("subj|__ Push email settings __");
30 StrBuf_ServGetln(Buf)) {
31 if ( (StrLength(Buf)==3) &&
32 !strcmp(ChrPtr(Buf), "000")) {
40 serv_printf("MSG0 %d", msgnum);
41 StrBuf_ServGetln(Buf);
42 if (GetServerStatus(Buf, NULL) == 1) {
46 StrBuf_ServGetln(Buf)) {
47 if (( (StrLength(Buf)==3) &&
48 !strcmp(ChrPtr(Buf), "000"))||
49 ((StrLength(Buf)==4) &&
50 !strcmp(ChrPtr(Buf), "text")))
56 if (!strcmp(ChrPtr(Buf), "text")) {
59 StrBuf_ServGetln(Buf)) {
60 if ( (StrLength(Buf)==3) &&
61 !strcmp(ChrPtr(Buf), "000")) {
65 if (strncasecmp(ChrPtr(Buf), "none", 4) == 0) {
67 } else if (strncasecmp(ChrPtr(Buf), "textmessage", 11) == 0) {
70 } else if (strncasecmp(ChrPtr(Buf), "funambol", 8) == 0) {
72 } else if (strncasecmp(ChrPtr(Buf), "httpmessage", 12) == 0) {
75 strncpy(mobnum, ChrPtr(Buf), 20);
82 svput("SMSNUM", WCS_STRING, " ");
83 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
84 StrBuf_ServGetln(Buf);
85 GetServerStatus(Buf, NULL);
87 output_headers(1, 1, 2, 0, 0, 0);
88 DoTemplate(HKEY("pushemail"), NULL, &SubTP);
93 void save_pushemail(void)
99 char *pushsetting = bstr("pushsetting");
102 if (strncasecmp(pushsetting, "textmessage", 11) == 0) {
103 sms = bstr("user_sms_number");
106 if (goto_config_room(Buf) != 0) {
108 return; /* oh well. */
110 serv_puts("MSGS ALL|0|1");
111 StrBuf_ServGetln(Buf);
112 if (GetServerStatus(Buf, NULL) == 8) {
113 serv_puts("subj|__ Push email settings __");
116 printf("Junk in save_pushemail buffer!: %s\n", buf);
122 StrBuf_ServGetln(Buf)) {
123 if ( (StrLength(Buf)==3) &&
124 !strcmp(ChrPtr(Buf), "000")) {
128 msgnum = StrTol(Buf);
132 serv_printf("DELE %d", msgnum);
133 StrBuf_ServGetln(Buf);
134 GetServerStatus(Buf, NULL);
137 serv_printf("ENT0 1||0|1|__ Push email settings __|");
138 StrBuf_ServGetln(Buf);
139 if (GetServerStatus(Buf, NULL) == 4) {
140 serv_puts(pushsetting);
148 /** Go back to the room we're supposed to be in */
149 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
150 StrBuf_ServGetln(Buf);
151 GetServerStatus(Buf, NULL);
152 http_redirect("display_pushemail");
160 WebcitAddUrlHandler(HKEY("display_pushemail"), "", 0, display_pushemail, 0);
161 WebcitAddUrlHandler(HKEY("save_pushemail"), "", 0, save_pushemail, 0);