#include <time.h>
#include "dynstuff.h"
Idź do kodu źródłowego tego pliku.
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
} |
Funkcje |
session_t * | session_find (const char *uid) |
session_t * | session_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_t * | session_add (const char *uid) |
int | session_remove (const char *uid) |
int | session_read (const char *filename) |
int | session_write () |
void | sessions_free () |
void | session_help (session_t *s, const char *name) |
Dokumentacja definicji
Dokumentacja definicji typów
session_t contains all information about session
Dokumentacja typów wyliczanych
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()
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.
int session_check |
( |
session_t * |
s, |
|
|
int |
need_private, |
|
|
const char * |
protocol |
|
) |
| |
int session_connected_set |
( |
session_t * |
s, |
|
|
int |
connected |
|
) |
| |
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()
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
-
- Zwraca
- It returns s if session was found, otherwise NULL.
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
int session_private_set |
( |
session_t * |
s, |
|
|
void * |
priv |
|
) |
| |
int session_read |
( |
const char * |
filename | ) |
|
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.
Dokumentacja zmiennych