X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fcookie_conversion.c;h=dcdc6da1c0af0e1adea0ca51a117864b686d945b;hb=HEAD;hp=111cacb7d51759d9198f28327a13e3b482b80929;hpb=c6aec42f213ec284e34648f3d69bcf927dccddb1;p=citadel.git diff --git a/webcit/cookie_conversion.c b/webcit/cookie_conversion.c index 111cacb7d..dcdc6da1c 100644 --- a/webcit/cookie_conversion.c +++ b/webcit/cookie_conversion.c @@ -1,4 +1,3 @@ - /* * Copyright (c) 1996-2012 by the citadel.org team * @@ -19,20 +18,22 @@ * the exact minute. :) */ static char *unset = "; expires=28-May-1971 18:10:00 GMT"; -typedef unsigned char byte; /* Byte type used by cookie_to_stuff() */ +typedef unsigned char byte; /* Byte type used by cookie_to_stuff() */ extern const char *get_selected_language(void); /* * Pack all session info into one easy-to-digest cookie. Healthy and delicious! */ -void stuff_to_cookie(int unset_cookies) { +void stuff_to_cookie(int unset_cookies) +{ wcsession *WCC = WC; char buf[SIZ]; if (unset_cookies) { hprintf("Set-cookie: webcit=%s; path=/\r\n", unset); } - else { + else + { StrBufAppendPrintf(WCC->HBuf, "Set-cookie: webcit="); snprintf(buf, sizeof(buf), "%d", WCC->wc_session); StrBufHexescAppend(WCC->HBuf, NULL, buf); @@ -47,10 +48,13 @@ void stuff_to_cookie(int unset_cookies) { StrBufHexescAppend(WCC->HBuf, NULL, "|"); if (server_cookie != NULL) { - StrBufAppendPrintf(WCC->HBuf, ";path=/ \r\n%s\r\n", server_cookie); + StrBufAppendPrintf(WCC->HBuf, + ";path=/ \r\n%s\r\n", + server_cookie); } else { - StrBufAppendBufPlain(WCC->HBuf, HKEY("; path=/\r\n"), 0); + StrBufAppendBufPlain(WCC->HBuf, + HKEY("; path=/\r\n"), 0); } } } @@ -58,7 +62,13 @@ void stuff_to_cookie(int unset_cookies) { /* * Extract all that fun stuff out of the cookie. */ -void cookie_to_stuff(StrBuf * cookie, int *session, StrBuf * user, StrBuf * pass, StrBuf * room, StrBuf * language) { +void cookie_to_stuff(StrBuf *cookie, + int *session, + StrBuf *user, + StrBuf *pass, + StrBuf *room, + StrBuf *language) +{ if (session != NULL) { *session = StrBufExtract_int(cookie, 0, '|'); }