Back to index

webcit  8.12-dfsg
Typedefs | Functions | Variables
cookie_conversion.c File Reference
#include "webcit.h"

Go to the source code of this file.

Typedefs

typedef unsigned char byte

Functions

const char * get_selected_language (void)
void stuff_to_cookie (int unset_cookies)
void cookie_to_stuff (StrBuf *cookie, int *session, StrBuf *user, StrBuf *pass, StrBuf *room, StrBuf *language)

Variables

static char * unset = "; expires=28-May-1971 18:10:00 GMT"

Typedef Documentation

typedef unsigned char byte

Definition at line 21 of file cookie_conversion.c.


Function Documentation

void cookie_to_stuff ( StrBuf *  cookie,
int *  session,
StrBuf *  user,
StrBuf *  pass,
StrBuf *  room,
StrBuf *  language 
)

Definition at line 65 of file cookie_conversion.c.

{
       if (session != NULL) {
              *session = StrBufExtract_int(cookie, 0, '|');
       }
       if (user != NULL) {
              StrBufExtract_token(user, cookie, 1, '|');
       }
       if (pass != NULL) {
              StrBufExtract_token(pass, cookie, 2, '|');
       }
       if (room != NULL) {
              StrBufExtract_token(room, cookie, 3, '|');
       }
       if (language != NULL) {
              StrBufExtract_token(language, cookie, 4, '|');
       }
}

Here is the caller graph for this function:

const char* get_selected_language ( void  )

Definition at line 440 of file gettext.c.

                                        {
#ifdef ENABLE_NLS
#ifdef HAVE_USELOCALE
       return AvailLang[WC->selected_language];
#else
       return "en";
#endif
#else
       return "en";
#endif
}

Here is the caller graph for this function:

void stuff_to_cookie ( int  unset_cookies)

Definition at line 27 of file cookie_conversion.c.

{
       wcsession *WCC = WC;
       char buf[SIZ];

       if (unset_cookies) {
              hprintf("Set-cookie: webcit=%s; path=/\r\n", unset);
       }
       else
       {
              StrBufAppendPrintf(WCC->HBuf, "Set-cookie: webcit=");
              snprintf(buf, sizeof(buf), "%d", WCC->wc_session);
              StrBufHexescAppend(WCC->HBuf, NULL, buf);
              StrBufHexescAppend(WCC->HBuf, NULL, "|");
              StrBufHexescAppend(WCC->HBuf, WCC->wc_username, NULL);
              StrBufHexescAppend(WCC->HBuf, NULL, "|");
              StrBufHexescAppend(WCC->HBuf, WCC->wc_password, NULL);
              StrBufHexescAppend(WCC->HBuf, NULL, "|");
              StrBufHexescAppend(WCC->HBuf, WCC->CurRoom.name, NULL);
              StrBufHexescAppend(WCC->HBuf, NULL, "|");
              StrBufHexescAppend(WCC->HBuf, NULL, get_selected_language());
              StrBufHexescAppend(WCC->HBuf, NULL, "|");

              if (server_cookie != NULL) {
                     StrBufAppendPrintf(WCC->HBuf, 
                                      ";path=/ \r\n%s\r\n", 
                                      server_cookie);
              }
              else {
                     StrBufAppendBufPlain(WCC->HBuf,
                                        HKEY("; path=/\r\n"), 0);
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char* unset = "; expires=28-May-1971 18:10:00 GMT" [static]

Definition at line 20 of file cookie_conversion.c.