ekg2
GIT master
|
#include "ekg2-config.h"
#include "win32.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include "dynstuff.h"
#include "sessions.h"
#include "plugins.h"
#include "windows.h"
Idź do kodu źródłowego tego pliku.
Struktury danych | |
struct | userlist |
struct | ekg_resource |
struct | ekg_group |
struct | ignore_label |
Definicje | |
#define | IGNORE_LABELS_MAX 9 |
#define | userlist_find_n(a, b) userlist_find(session_find(a), b) |
#define | user_private_item_get_safe(user, name, result) private_item_get_safe(&(user)->priv_list, name, result) |
#define | user_private_item_get(user, name) private_item_get(&(user)->priv_list, name) |
#define | user_private_item_get_int_safe(user, name, result) private_item_get_int_safe(&(user)->priv_list), name, int *result) |
#define | user_private_item_get_int(user, name) private_item_get_int(&(user)->priv_list, name) |
#define | user_private_item_set(user, name, value) private_item_set(&(user)->priv_list, name, value) |
#define | user_private_item_set_int(user, name, value) private_item_set_int(&(user)->priv_list, name, value) |
#define | user_private_items_destroy(user) private_items_destroy(&(user)->priv_list); |
Definicje typów | |
typedef struct userlist | userlist_t |
typedef struct ekg_resource | ekg_resource_t |
Wyliczenia | |
enum | xstate_t { EKG_XSTATE_BLINK = 1, EKG_XSTATE_TYPING = 2, EKG_XSTATE_BLINK = 1, EKG_XSTATE_TYPING = 2 } |
enum | userlist_privhandler_func_t { EKG_USERLIST_PRIVHANDLER_FREE = 0, EKG_USERLIST_PRIVHANDLER_GET, EKG_USERLIST_PRIVHANDLER_READING, EKG_USERLIST_PRIVHANDLER_WRITING, EKG_USERLIST_PRIVHANDLER_SETVAR_BYNAME = 0xC0 } |
enum | ignore_t { IGNORE_STATUS = 0x01, IGNORE_STATUS_DESCR = 0x02, IGNORE_MSG = 0x04, IGNORE_DCC = 0x08, IGNORE_EVENTS = 0x10, IGNORE_NOTIFY = 0x20, IGNORE_XOSD = 0x40, IGNORE_LOG = 0x80, IGNORE_ALL = 0xFF, IGNORE_STATUS = 0x01, IGNORE_STATUS_DESCR = 0x02, IGNORE_MSG = 0x04, IGNORE_DCC = 0x08, IGNORE_EVENTS = 0x10, IGNORE_NOTIFY = 0x20, IGNORE_XOSD = 0x40, IGNORE_LOG = 0x80, IGNORE_ALL = 0xFF } |
Funkcje | |
int | userlist_read (session_t *session) |
void | userlist_write (session_t *session) |
void | userlist_clear_status (session_t *session, const char *uid) |
userlist_t * | userlist_add (session_t *session, const char *uid, const char *nickname) |
userlist_t * | userlist_add_u (userlist_t **userlist, const char *uid, const char *nickname) |
void | userlist_add_entry (session_t *session, const char *line) |
int | userlist_remove (session_t *session, userlist_t *u) |
int | userlist_remove_u (userlist_t **userlist, userlist_t *u) |
int | userlist_replace (session_t *session, userlist_t *u) |
userlist_t * | userlist_find (session_t *session, const char *uid) |
userlist_t * | userlist_find_u (userlist_t **userlist, const char *uid) |
void | userlist_free (session_t *session) |
void | userlists_destroy (userlist_t **userlist) |
void * | userlist_private_get (plugin_t *plugin, userlist_t *u) |
ekg_resource_t * | userlist_resource_add (userlist_t *u, const char *name, int prio) |
ekg_resource_t * | userlist_resource_find (userlist_t *u, const char *name) |
void | userlist_resource_remove (userlist_t *u, ekg_resource_t *r) |
int | ignored_add (session_t *session, const char *uid, ignore_t level) |
int | ignored_remove (session_t *session, const char *uid) |
int | ignored_check (session_t *session, const char *uid) |
int | ignore_flags (const char *str) |
const char * | ignore_format (int level) |
int | ekg_group_add (userlist_t *u, const char *group) |
int | ekg_group_remove (userlist_t *u, const char *group) |
int | ekg_group_member (userlist_t *u, const char *group) |
char * | group_to_string (struct ekg_group *l, int meta, int sep) |
struct ekg_group * | group_init (const char *groups) |
int | valid_nick (const char *nick) |
int | valid_plugin_uid (plugin_t *plugin, const char *uid) |
const char * | format_user (session_t *session, const char *uid) |
const char * | get_uid (session_t *session, const char *text) |
const char * | get_uid_any (session_t *session, const char *text) |
const char * | get_nickname (session_t *session, const char *text) |
char * | get_user_name (userlist_t *u) |
Zmienne | |
struct ignore_label | ignore_labels [9] |
#define IGNORE_LABELS_MAX 9 |
#define user_private_item_get | ( | user, | |
name | |||
) | private_item_get(&(user)->priv_list, name) |
#define user_private_item_get_int | ( | user, | |
name | |||
) | private_item_get_int(&(user)->priv_list, name) |
#define user_private_item_get_int_safe | ( | user, | |
name, | |||
result | |||
) | private_item_get_int_safe(&(user)->priv_list), name, int *result) |
#define user_private_item_get_safe | ( | user, | |
name, | |||
result | |||
) | private_item_get_safe(&(user)->priv_list, name, result) |
#define user_private_item_set | ( | user, | |
name, | |||
value | |||
) | private_item_set(&(user)->priv_list, name, value) |
#define user_private_item_set_int | ( | user, | |
name, | |||
value | |||
) | private_item_set_int(&(user)->priv_list, name, value) |
#define user_private_items_destroy | ( | user | ) | private_items_destroy(&(user)->priv_list); |
#define userlist_find_n | ( | a, | |
b | |||
) | userlist_find(session_find(a), b) |
typedef struct ekg_resource ekg_resource_t |
ekg_resource_t is used to manage userlist_t resources.
For example jabber resources, or irc friendlist
typedef struct userlist userlist_t |
userlist_t is used to manage all info about user.
It's used not only to manage contacts in roster, but also to manage people in chat or conference
enum ignore_t |
userlist_privhandler_func_t - here we declare possible options for 'function' arg in USERLIST_PRIVHANDLE
All of them, excluding EKG_USERLIST_PRIVHANDLER_FREE, should alloc&init priv if needed
Wartości wyliczeń | |
---|---|
EKG_USERLIST_PRIVHANDLER_FREE | Free private data (called when freeing userlist_t) |
EKG_USERLIST_PRIVHANDLER_GET | Return private data ptr, arg is void** for ptr |
EKG_USERLIST_PRIVHANDLER_READING | Called when reading userlist file, |
EKG_USERLIST_PRIVHANDLER_WRITING | Called when writing userlist file, arg is char*** with data array |
EKG_USERLIST_PRIVHANDLER_SETVAR_BYNAME | Set private 'variable' by name, args care char** with var name and char** with value (will be duplicated) |
enum xstate_t |
int ekg_group_add | ( | userlist_t * | u, |
const char * | group | ||
) |
dodaje użytkownika do podanej grupy.
u | - wpis usera, |
group | - nazwa grupy. |
int ekg_group_member | ( | userlist_t * | u, |
const char * | group | ||
) |
sprawdza czy użytkownik jest członkiem danej grupy.
u | - uzytkownik, ktorego chcemy sprawdzic |
group | - grupa ktora chcemy sprawdzic |
int ekg_group_remove | ( | userlist_t * | u, |
const char * | group | ||
) |
usuwa użytkownika z podanej grupy.
u | - wpis usera, |
group | - nazwa grupy. |
const char* format_user | ( | session_t * | session, |
const char * | uid | ||
) |
const char* get_nickname | ( | session_t * | session, |
const char * | text | ||
) |
const char* get_uid | ( | session_t * | session, |
const char * | text | ||
) |
Return and checks if uid passed text is proper for session or it's nickname of smb on session userlist.
userlist_find(s, get_uid(s, target))
return the same as userlist_find(s, target)
userlist_find(s, get_uid(s, get_uid(s, get_uid(s, target))))
won't helpsession | - session to check for, if NULL check all sessions (it doesn't look at userlists, in this mode) |
text | - uid to check for, if '$' than check current window. |
const char* get_uid_any | ( | session_t * | session, |
const char * | text | ||
) |
Return and checks if uid passed text is proper for at least one session, or it's nickname of smb on session userlist
session | - session to search for item on userlist |
text | - uid to check for, if '$' then check current window. |
char* get_user_name | ( | userlist_t * | u | ) |
struct ekg_group* group_init | ( | const char * | names | ) |
inicjuje listę grup użytkownika na podstawie danego ciągu znaków, w którym kolejne nazwy grup są rozdzielone przecinkiem.
names | - nazwy grup. |
char* group_to_string | ( | struct ekg_group * | groups, |
int | meta, | ||
int | sep | ||
) |
zmienia listę grup na ciąg znaków rodzielony przecinkami.
groups | - lista grup. |
meta | - czy dołączyć ,,meta-grupy''? |
sep | - czy oddzielać przecinkiem i spacją? |
int ignore_flags | ( | const char * | str | ) |
zamienia łańcuch znaków na odpowiedni poziom ignorowania w postaci liczby.
str |
const char* ignore_format | ( | int | level | ) |
zwraca statyczny łańcuch znaków reprezentujący dany poziom ignorowania.
level | - poziom ignorowania, bitmaska z `enum ignore_t' |
ignore_labels
int ignored_check | ( | session_t * | session, |
const char * | uid | ||
) |
czy dany numerek znajduje się na liście ignorowanych.
session | - sesja w ktorej mamy szukac uzytkownika |
uid | - uid uzytkownika |
int ignored_remove | ( | session_t * | session, |
const char * | uid | ||
) |
userlist_t* userlist_add | ( | session_t * | session, |
const char * | uid, | ||
const char * | nickname | ||
) |
void userlist_add_entry | ( | session_t * | session, |
const char * | line | ||
) |
userlist_t* userlist_add_u | ( | userlist_t ** | userlist, |
const char * | uid, | ||
const char * | nickname | ||
) |
void userlist_clear_status | ( | session_t * | session, |
const char * | uid | ||
) |
If uin == NULL then it clears all users presence information in the session userlist otherwise it clears only specified user It's useful if user goes notavail, or we goes disconnected..
However if that happen you shouldn't use this function but emit query PROTOCOL_STATUS or PROTOCOL_DISCONNECTED
session | |
uid |
userlist_t* userlist_find | ( | session_t * | session, |
const char * | uid | ||
) |
userlist_t* userlist_find_u | ( | userlist_t ** | userlist, |
const char * | uid | ||
) |
void userlist_free | ( | session_t * | session | ) |
void* userlist_private_get | ( | plugin_t * | plugin, |
userlist_t * | u | ||
) |
int userlist_read | ( | session_t * | session | ) |
wczytuje listę kontaktów z pliku uid_sesji-userlist w postaci eksportu tekstowego listy kontaktów windzianego klienta.
session |
int userlist_remove | ( | session_t * | session, |
userlist_t * | u | ||
) |
int userlist_remove_u | ( | userlist_t ** | userlist, |
userlist_t * | u | ||
) |
int userlist_replace | ( | session_t * | session, |
userlist_t * | u | ||
) |
ekg_resource_t* userlist_resource_add | ( | userlist_t * | u, |
const char * | name, | ||
int | prio | ||
) |
It adds new user resource to resources list, with given data.
u | - user |
name | - name of resource |
prio | - prio of resource |
ekg_resource_t* userlist_resource_find | ( | userlist_t * | u, |
const char * | name | ||
) |
It search for given resource name in user resource list u
u | - user |
name | - name of resource |
void userlist_resource_remove | ( | userlist_t * | u, |
ekg_resource_t * | r | ||
) |
Remove given resource r from user resource list u
Free allocated memory.
u | - user |
r | - resource |
void userlist_write | ( | session_t * | session | ) |
It writes session userlist to file: session->uid-userlist in ekg2 config directory
session |
void userlists_destroy | ( | userlist_t ** | userlist | ) |
int valid_nick | ( | const char * | nick | ) |
int valid_plugin_uid | ( | plugin_t * | plugin, |
const char * | uid | ||
) |
Check if uid can be handled by given plugin
plugin | - plugin to check for |
uid | - uid to check for |
struct ignore_label ignore_labels[9] |