ekg2  GIT master
Struktury danych | Definicje | Definicje typów | Wyliczenia | Funkcje | Zmienne
Dokumentacja pliku sessions.h
#include <time.h>
#include "dynstuff.h"
Wykres zależności załączania dla sessions.h:
Ten wykres pokazuje, które pliki bezpośrednio lub pośrednio załączają ten plik:

Idź do kodu źródłowego tego pliku.

Struktury danych

struct  session_param
 
struct  ekg_session
 

Definicje

#define EKG_STATUS_IS_NODELIVERY(x)   (x < EKG_STATUS_UNKNOWN)
 
#define EKG_STATUS_IS_NA(x)   (x <= EKG_STATUS_NA)
 
#define EKG_STATUS_IS_AWAY(x)   ((x > EKG_STATUS_NA) && (x < EKG_STATUS_AVAIL))
 
#define EKG_STATUS_IS_AVAIL(x)   (x >= EKG_STATUS_AVAIL)
 
#define session_status_get_n(a)   session_status_get(session_find(a))
 
#define session_format_n(a)   session_format(session_find(a))
 
#define session_alias_uid(a)   (a->alias) ? a->alias : a->uid
 
#define session_alias_uid_n(a)   session_alias_uid(session_find(a))
 

Definicje typów

typedef struct session_param session_param_t
 
typedef struct ekg_session session_t
 

Wyliczenia

enum  status_t {
  EKG_STATUS_NULL = 0x00, EKG_STATUS_ERROR, EKG_STATUS_BLOCKED, EKG_STATUS_UNKNOWN,
  EKG_STATUS_NA, EKG_STATUS_INVISIBLE, EKG_STATUS_DND, EKG_STATUS_GONE,
  EKG_STATUS_XA, EKG_STATUS_AWAY, EKG_STATUS_AVAIL, EKG_STATUS_FFC,
  EKG_STATUS_LAST, EKG_STATUS_AUTOAWAY = 0x80, EKG_STATUS_AUTOXA, EKG_STATUS_AUTOBACK,
  EKG_STATUS_NULL = 0x00, EKG_STATUS_ERROR, EKG_STATUS_BLOCKED, EKG_STATUS_UNKNOWN,
  EKG_STATUS_NA, EKG_STATUS_INVISIBLE, EKG_STATUS_DND, EKG_STATUS_GONE,
  EKG_STATUS_XA, EKG_STATUS_AWAY, EKG_STATUS_AVAIL, EKG_STATUS_FFC
}
 
enum  chatstates_t {
  EKG_CHATSTATE_COMPOSING = 1 << 0, EKG_CHATSTATE_ACTIVE = 1 << 1, EKG_CHATSTATE_GONE = 1 << 2, _EKG_CHATSTATE_NOT = 1 << 10,
  EKG_CHATSTATE_PAUSED = _EKG_CHATSTATE_NOT | EKG_CHATSTATE_COMPOSING, EKG_CHATSTATE_INACTIVE = _EKG_CHATSTATE_NOT | EKG_CHATSTATE_ACTIVE
}
 

Funkcje

session_tsession_find (const char *uid)
 
session_tsession_find_ptr (session_t *s)
 
int session_is_var (session_t *s, const char *key)
 
const char * session_uid_get (session_t *s)
 
const char * session_alias_get (session_t *s)
 
int session_alias_set (session_t *s, const char *alias)
 
int session_status_get (session_t *s)
 
int session_status_set (session_t *s, status_t status)
 
const char * session_descr_get (session_t *s)
 
int session_descr_set (session_t *s, const char *descr)
 
const char * session_password_get (session_t *s)
 
int session_password_set (session_t *s, const char *password)
 
void * session_private_get (session_t *s)
 
int session_private_set (session_t *s, void *priv)
 
int session_connected_get (session_t *s)
 
int session_connected_set (session_t *s, int connected)
 
const char * session_get (session_t *s, const char *key)
 
int session_int_get (session_t *s, const char *key)
 
int session_set (session_t *s, const char *key, const char *value)
 
int session_int_set (session_t *s, const char *key, int value)
 
const char * session_format (session_t *s)
 
const char * session_name (session_t *s)
 
int session_check (session_t *s, int need_private, const char *protocol)
 
int session_unidle (session_t *s)
 
session_tsession_add (const char *uid)
 
int session_remove (const char *uid)
 
int session_read (const gchar *plugin_name) G_GNUC_INTERNAL
 
void session_write ()
 
void sessions_free ()
 
void session_help (session_t *s, const char *name)
 

Zmienne

session_tsessions
 
session_tsession_current
 

Dokumentacja definicji

◆ EKG_STATUS_IS_AVAIL

#define EKG_STATUS_IS_AVAIL (   x)    (x >= EKG_STATUS_AVAIL)

◆ EKG_STATUS_IS_AWAY

#define EKG_STATUS_IS_AWAY (   x)    ((x > EKG_STATUS_NA) && (x < EKG_STATUS_AVAIL))

◆ EKG_STATUS_IS_NA

#define EKG_STATUS_IS_NA (   x)    (x <= EKG_STATUS_NA)

◆ EKG_STATUS_IS_NODELIVERY

#define EKG_STATUS_IS_NODELIVERY (   x)    (x < EKG_STATUS_UNKNOWN)

◆ session_alias_uid

#define session_alias_uid (   a)    (a->alias) ? a->alias : a->uid

◆ session_alias_uid_n

#define session_alias_uid_n (   a)    session_alias_uid(session_find(a))

◆ session_format_n

#define session_format_n (   a)    session_format(session_find(a))

◆ session_status_get_n

#define session_status_get_n (   a)    session_status_get(session_find(a))

Dokumentacja definicji typów

◆ session_param_t

◆ session_t

typedef struct ekg_session session_t

session_t contains all information about session

Dokumentacja typów wyliczanych

◆ chatstates_t

Wartości wyliczeń
EKG_CHATSTATE_COMPOSING 
EKG_CHATSTATE_ACTIVE 
EKG_CHATSTATE_GONE 
_EKG_CHATSTATE_NOT 
EKG_CHATSTATE_PAUSED 
EKG_CHATSTATE_INACTIVE 

◆ status_t

enum status_t

status_t - user's current status, as prioritized enum

Wartości wyliczeń
EKG_STATUS_NULL 
EKG_STATUS_ERROR 
EKG_STATUS_BLOCKED 
EKG_STATUS_UNKNOWN 
EKG_STATUS_NA 
EKG_STATUS_INVISIBLE 
EKG_STATUS_DND 
EKG_STATUS_GONE 
EKG_STATUS_XA 
EKG_STATUS_AWAY 
EKG_STATUS_AVAIL 
EKG_STATUS_FFC 
EKG_STATUS_LAST 
EKG_STATUS_AUTOAWAY 
EKG_STATUS_AUTOXA 
EKG_STATUS_AUTOBACK 
EKG_STATUS_NULL 
EKG_STATUS_ERROR 
EKG_STATUS_BLOCKED 
EKG_STATUS_UNKNOWN 
EKG_STATUS_NA 
EKG_STATUS_INVISIBLE 
EKG_STATUS_DND 
EKG_STATUS_GONE 
EKG_STATUS_XA 
EKG_STATUS_AWAY 
EKG_STATUS_AVAIL 
EKG_STATUS_FFC 

Dokumentacja funkcji

◆ session_add()

session_t* session_add ( const char *  uid)

session_add()

Add session with uid to session list.
Check by plugin_find_uid() if any plugin can handle this type of session if not return NULL
Allocate memory for variables, switch windows.. etc, etc..
Emit global SESSION_ADDED plugin which handle this session can alloc memory for his private data

Do zrobienia:
See XXX's
Parametry
uid- full uid of new session
Zobacz również
session_remove() - To remove session
Zwraca
NULL if none plugin can handle this session uid
allocated session_t struct.

◆ session_alias_get()

const char* session_alias_get ( session_t s)

◆ session_alias_set()

int session_alias_set ( session_t s,
const char *  alias 
)

◆ session_check()

int session_check ( session_t s,
int  need_private,
const char *  protocol 
)

◆ session_connected_get()

int session_connected_get ( session_t s)

◆ session_connected_set()

int session_connected_set ( session_t s,
int  connected 
)

◆ session_descr_get()

const char* session_descr_get ( session_t s)

◆ session_descr_set()

int session_descr_set ( session_t s,
const char *  descr 
)

◆ session_find()

session_t* session_find ( const char *  uid)

session_find()

It's search over sessions list and checks if we have session with uid uid

Parametry
uid- uid of session you look for
Zobacz również
session_find_ptr() - If you are looking for smth faster ;) but less reliable.
Zwraca
It returns pointer to session_t struct of found session, or NULL

◆ session_find_ptr()

session_t* session_find_ptr ( session_t s)

session_find_ptr()

it's search over sessions list and checks if param s is in that list. it's useful for all watch handler, and if programmer was too lazy to destroy watches associated with that session (in private watch data struct) before it gone.

Nota
It's possible to find another session with the same address as old one.. it's rather not possible.. however. It's better if you use session_find() function.. Yeah, i know it's slower.
Parametry
s- session to look for.
Zwraca
It returns s if session was found, otherwise NULL.

◆ session_format()

const char* session_format ( session_t s)

◆ session_get()

const char* session_get ( session_t s,
const char *  key 
)

◆ session_help()

void session_help ( session_t s,
const char *  name 
)

◆ session_int_get()

int session_int_get ( session_t s,
const char *  key 
)

◆ session_int_set()

int session_int_set ( session_t s,
const char *  key,
int  value 
)

◆ session_is_var()

int session_is_var ( session_t s,
const char *  key 
)

◆ session_name()

const char* session_name ( session_t s)

◆ session_password_get()

const char* session_password_get ( session_t s)

session_password_get()

It's decrypt ,,encrypted''(and return) using base64 from session struct (s->password) is s was passed, otherwise it cleanup decrypted password from internal buffer.

Nota
static buffer is a better idea - i think (del)
Zobacz również
base64_decode() - function to decode base64 strings.
session_get() - session_get() can be used to get password also... but it's just a wrapper with several xstrcmp() to this function so it's slower. Instead of using session_get(session, "password") it's better If you use: session_password_get(session)
Parametry
s- session of which we want get password from or NULL if we want to erase internal buf with password
Zwraca
,,decrypted'' password if succeed
otherwise ""
or even NULL if s was NULL

◆ session_password_set()

int session_password_set ( session_t s,
const char *  password 
)

◆ session_private_get()

void* session_private_get ( session_t s)

◆ session_private_set()

int session_private_set ( session_t s,
void *  priv 
)

◆ session_read()

int session_read ( const gchar *  plugin_name)

◆ session_remove()

int session_remove ( const char *  uid)

session_remove()

Remove session with uid passed in uid
This function free session params variable and internal
session data like alias, current status, descr, password..
If sesssion is connected, /disconnect command will be executed with session uid as reason
Also it remove watches connected with this session (if watch->is_session && watch->data == s)br> It'll do window->session swapping if needed... and changing current session also.

Błąd:
Possible implementation/idea bug in window_session_cycle() I really don't know if we should change session on this windows... Maybe swaping is ok... but we really need think about protocol.. Now If we change session from jabber to gg one this window won't be very useful..
Nota
If plugin allocated memory for session example in s->priv you should connect to SESSION_REMOVED query event, and free alloced memory (remember about checking if this is your session) timers and watches will be automagicly removed.
Current ekg2 API have got session watches. Use watch_add_session()
Current ekg2 API have got timer watches. Use timer_add_session()
Parametry
uid- uid of session to remove
Zwraca
0 if session was found, and removed.
-1 if session wasn't founded.

◆ session_set()

int session_set ( session_t s,
const char *  key,
const char *  value 
)

◆ session_status_get()

int session_status_get ( session_t s)

◆ session_status_set()

int session_status_set ( session_t s,
status_t  status 
)

◆ session_uid_get()

const char* session_uid_get ( session_t s)

◆ session_unidle()

int session_unidle ( session_t s)

◆ session_write()

void session_write ( )

◆ sessions_free()

void sessions_free ( )

Dokumentacja zmiennych

◆ session_current

session_t* session_current

◆ sessions

session_t* sessions