X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Flistsub.c;h=d445d05bd16cacdda9da0a7fe2850b02968100e7;hb=e322a532492f9f4e50bae5a7955a6218b24a26ea;hp=5d9ceb8a7b1ac6baed11707263887cdb748eb1df;hpb=b39d860713ddd390339211be8d398c4d4b6680ba;p=citadel.git diff --git a/webcit/listsub.c b/webcit/listsub.c index 5d9ceb8a7..d445d05bd 100644 --- a/webcit/listsub.c +++ b/webcit/listsub.c @@ -17,14 +17,16 @@ /* * List subscription handling */ - -int Conditional_LISTSUB_EXECUTE_SUBSCRIBE(StrBuf *Target, WCTemplputParams *TP) -{ +int Conditional_LISTSUB_EXECUTE_SUBSCRIBE(StrBuf *Target, WCTemplputParams *TP) { int rc; StrBuf *Line; const char *ImpMsg; - const StrBuf *Room, *Email, *SubType; - + const StrBuf *Room, *Email; + + if (strcmp(bstr("cmd"), "subscribe")) { + return 0; + } + Room = sbstr("room"); if (Room == NULL) { @@ -39,30 +41,29 @@ int Conditional_LISTSUB_EXECUTE_SUBSCRIBE(StrBuf *Target, WCTemplputParams *TP) AppendImportantMessage(ImpMsg, -1); return 0; } - SubType = sbstr("subtype"); Line = NewStrBuf(); - serv_printf("SUBS subscribe|%s|%s|%s|%s/listsub", - ChrPtr(Room), - ChrPtr(Email), - ChrPtr(SubType), - ChrPtr(site_prefix) - ); + serv_printf("LSUB subscribe|%s|%s|%s/listsub", ChrPtr(Room), ChrPtr(Email), ChrPtr(site_prefix)); StrBuf_ServGetln(Line); rc = GetServerStatusMsg(Line, NULL, 1, 2); FreeStrBuf(&Line); - if (rc == 2) + if (rc == 2) { putbstr("__FAIL", NewStrBufPlain(HKEY("1"))); + } return rc == 2; } -int Conditional_LISTSUB_EXECUTE_UNSUBSCRIBE(StrBuf *Target, WCTemplputParams *TP) -{ + +int Conditional_LISTSUB_EXECUTE_UNSUBSCRIBE(StrBuf *Target, WCTemplputParams *TP) { int rc; StrBuf *Line; const char *ImpMsg; const StrBuf *Room, *Email; - + + if (strcmp(bstr("cmd"), "unsubscribe")) { + return 0; + } + Room = sbstr("room"); if (Room == NULL) { @@ -78,11 +79,7 @@ int Conditional_LISTSUB_EXECUTE_UNSUBSCRIBE(StrBuf *Target, WCTemplputParams *TP return 0; } - serv_printf("SUBS unsubscribe|%s|%s|%s/listsub", - ChrPtr(Room), - ChrPtr(Email), - ChrPtr(site_prefix) - ); + serv_printf("LSUB unsubscribe|%s|%s|%s/listsub", ChrPtr(Room), ChrPtr(Email), ChrPtr(site_prefix)); Line = NewStrBuf(); StrBuf_ServGetln(Line); rc = GetServerStatusMsg(Line, NULL, 1, 2); @@ -98,7 +95,11 @@ int Conditional_LISTSUB_EXECUTE_CONFIRM_SUBSCRIBE(StrBuf *Target, WCTemplputPara StrBuf *Line; const char *ImpMsg; const StrBuf *Room, *Token; - + + if (strcmp(bstr("cmd"), "confirm")) { + return 0; + } + Room = sbstr("room"); if (Room == NULL) { @@ -115,10 +116,7 @@ int Conditional_LISTSUB_EXECUTE_CONFIRM_SUBSCRIBE(StrBuf *Target, WCTemplputPara } Line = NewStrBuf(); - serv_printf("SUBS confirm|%s|%s", - ChrPtr(Room), - ChrPtr(Token) - ); + serv_printf("LSUB confirm|%s|%s", ChrPtr(Room), ChrPtr(Token)); StrBuf_ServGetln(Line); rc = GetServerStatusMsg(Line, NULL, 1, 2); FreeStrBuf(&Line);