ekg2  GIT master
Struktury danych | Definicje | Definicje typów | Wyliczenia | Funkcje | Zmienne
Dokumentacja pliku userlist.h
#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"
Wykres zależności załączania dla userlist.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  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_tuserlist_add (session_t *session, const char *uid, const char *nickname)
 
userlist_tuserlist_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_tuserlist_find (session_t *session, const char *uid)
 
userlist_tuserlist_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_tuserlist_resource_add (userlist_t *u, const char *name, int prio)
 
ekg_resource_tuserlist_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_groupgroup_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]
 

Dokumentacja definicji

◆ IGNORE_LABELS_MAX

#define IGNORE_LABELS_MAX   9

◆ user_private_item_get

#define user_private_item_get (   user,
  name 
)    private_item_get(&(user)->priv_list, name)

◆ user_private_item_get_int

#define user_private_item_get_int (   user,
  name 
)    private_item_get_int(&(user)->priv_list, name)

◆ user_private_item_get_int_safe

#define user_private_item_get_int_safe (   user,
  name,
  result 
)    private_item_get_int_safe(&(user)->priv_list), name, int *result)

◆ user_private_item_get_safe

#define user_private_item_get_safe (   user,
  name,
  result 
)    private_item_get_safe(&(user)->priv_list, name, result)

◆ user_private_item_set

#define user_private_item_set (   user,
  name,
  value 
)    private_item_set(&(user)->priv_list, name, value)

◆ user_private_item_set_int

#define user_private_item_set_int (   user,
  name,
  value 
)    private_item_set_int(&(user)->priv_list, name, value)

◆ user_private_items_destroy

#define user_private_items_destroy (   user)    private_items_destroy(&(user)->priv_list);

◆ userlist_find_n

#define userlist_find_n (   a,
 
)    userlist_find(session_find(a), b)

Dokumentacja definicji typów

◆ ekg_resource_t

typedef struct ekg_resource ekg_resource_t

ekg_resource_t is used to manage userlist_t resources.
For example jabber resources, or irc friendlist

◆ userlist_t

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

Błąd:
There are two private fields [u->priv_data and u->priv] one needs to be removed.

Dokumentacja typów wyliczanych

◆ ignore_t

enum ignore_t
Wartości wyliczeń
IGNORE_STATUS 
IGNORE_STATUS_DESCR 
IGNORE_MSG 
IGNORE_DCC 
IGNORE_EVENTS 
IGNORE_NOTIFY 
IGNORE_XOSD 
IGNORE_LOG 
IGNORE_ALL 
IGNORE_STATUS 
IGNORE_STATUS_DESCR 
IGNORE_MSG 
IGNORE_DCC 
IGNORE_EVENTS 
IGNORE_NOTIFY 
IGNORE_XOSD 
IGNORE_LOG 
IGNORE_ALL 

◆ userlist_privhandler_func_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,
1st arg is char*** with data array,
2nd arg is int* with array element count you can assume it's always at least 7
Please bear in mind that this query is called at the very beginning of userlist_add_entry()

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)

◆ xstate_t

enum xstate_t
Wartości wyliczeń
EKG_XSTATE_BLINK 
EKG_XSTATE_TYPING 
EKG_XSTATE_BLINK 
EKG_XSTATE_TYPING 

Dokumentacja funkcji

◆ ekg_group_add()

int ekg_group_add ( userlist_t u,
const char *  group 
)

ekg_group_add()

dodaje użytkownika do podanej grupy.

Parametry
u- wpis usera,
group- nazwa grupy.
Zwraca
-1 jesli juz user jest w tej grupie, lub zle parametry. 0 gdy dodano.

◆ ekg_group_member()

int ekg_group_member ( userlist_t u,
const char *  group 
)

ekg_group_member()

sprawdza czy użytkownik jest członkiem danej grupy.

Parametry
u- uzytkownik, ktorego chcemy sprawdzic
group- grupa ktora chcemy sprawdzic
Zwraca
1 jeśli tak, 0 jeśli nie.

◆ ekg_group_remove()

int ekg_group_remove ( userlist_t u,
const char *  group 
)

ekg_group_remove()

usuwa użytkownika z podanej grupy.

Parametry
u- wpis usera,
group- nazwa grupy.
Zwraca
0 jeśli się udało, inaczej -1.

◆ format_user()

const char* format_user ( session_t session,
const char *  uid 
)

◆ get_nickname()

const char* get_nickname ( session_t session,
const char *  text 
)

◆ get_uid()

const char* get_uid ( session_t session,
const char *  text 
)

get_uid()

Return and checks if uid passed text is proper for session or it's nickname of smb on session userlist.

Nota
It also work with userlist_find() and if text is nickname of smb in session userlist.. Than it return uid of this user. So you shouldn't call userlist_find() with get_uid() as param, cause it's senseless userlist_find() don't check for "$" target, so you must do it by hand. Rest is the same. If there are such user: userlist_find(s, get_uid(s, target)) return the same as userlist_find(s, target)
If not, even userlist_find(s, get_uid(s, get_uid(s, get_uid(s, target)))) won't help
Parametry
session- 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.
Zobacz również
userlist_find()
get_nickname() - to look for nickname..
get_uid_any() - to do all session searching+specified session userlist search.. This function does only all session searching if session is NULL... and than it doesn't look at userlist. Do you feel difference?
Zwraca
If we found proper uid for text, than return it. Otherwise NULL

◆ get_uid_any()

const char* get_uid_any ( session_t session,
const char *  text 
)

get_uid_any()

Return and checks if uid passed text is proper for at least one session, or it's nickname of smb on session userlist

Parametry
session- session to search for item on userlist
text- uid to check for, if '$' then check current window.
Zobacz również
get_uid() - to search only specified session.
Zwraca
If we found proper uid for text, than return it. Otherwise NULL

◆ get_user_name()

char* get_user_name ( userlist_t u)

◆ group_init()

struct ekg_group* group_init ( const char *  names)

group_init()

inicjuje listę grup użytkownika na podstawie danego ciągu znaków, w którym kolejne nazwy grup są rozdzielone przecinkiem.

Parametry
names- nazwy grup.
Zwraca
zwraca listę `struct group' jeśli się udało, inaczej NULL.

◆ group_to_string()

char* group_to_string ( struct ekg_group groups,
int  meta,
int  sep 
)

group_to_string()

zmienia listę grup na ciąg znaków rodzielony przecinkami.

Parametry
groups- lista grup.
meta- czy dołączyć ,,meta-grupy''?
sep- czy oddzielać przecinkiem i spacją?
Zwraca
zwraca zaalokowany ciąg znaków lub NULL w przypadku błędu.

◆ ignore_flags()

int ignore_flags ( const char *  str)

ignore_flags()

zamienia łańcuch znaków na odpowiedni poziom ignorowania w postaci liczby.

Parametry
str
Zobacz również
ignore_format
ignore_t
ignore_labels
Zwraca
zwraca bitmaske opisana przez str

◆ ignore_format()

const char* ignore_format ( int  level)

ignore_format()

zwraca statyczny łańcuch znaków reprezentujący dany poziom ignorowania.

Parametry
level- poziom ignorowania, bitmaska z `enum ignore_t'
Zobacz również
ignore_flags
ignore_t
ignore_labels
Zwraca
zwraca statyczny bufor opisujacy bitmaske za pomoca ignore_labels

◆ ignored_add()

int ignored_add ( session_t session,
const char *  uid,
ignore_t  level 
)

◆ ignored_check()

int ignored_check ( session_t session,
const char *  uid 
)

ignored_check()

czy dany numerek znajduje się na liście ignorowanych.

Parametry
session- sesja w ktorej mamy szukac uzytkownika
uid- uid uzytkownika

◆ ignored_remove()

int ignored_remove ( session_t session,
const char *  uid 
)

◆ userlist_add()

userlist_t* userlist_add ( session_t session,
const char *  uid,
const char *  nickname 
)

◆ userlist_add_entry()

void userlist_add_entry ( session_t session,
const char *  line 
)

◆ userlist_add_u()

userlist_t* userlist_add_u ( userlist_t **  userlist,
const char *  uid,
const char *  nickname 
)

◆ userlist_clear_status()

void userlist_clear_status ( session_t session,
const char *  uid 
)

userlist_clear_status()

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

Nota
By presence information I mean:
-> status - user's status [avail, away, ffc, dnd], it'll be: EKG_STATUS_NA ("notavail")
-> descr - user's description, it'll be: NULL
-> ip - user's ip, il'll be: 0.0.0.0
-> port - user's port, it'll be: 0
-> resources - user's resource, list will be destroyed.
Parametry
session
uid

◆ userlist_find()

userlist_t* userlist_find ( session_t session,
const char *  uid 
)

◆ userlist_find_u()

userlist_t* userlist_find_u ( userlist_t **  userlist,
const char *  uid 
)

◆ userlist_free()

void userlist_free ( session_t session)

◆ userlist_private_get()

void* userlist_private_get ( plugin_t plugin,
userlist_t u 
)

◆ userlist_read()

int userlist_read ( session_t session)

userlist_read()

wczytuje listę kontaktów z pliku uid_sesji-userlist w postaci eksportu tekstowego listy kontaktów windzianego klienta.

Parametry
session
Zwraca
0 on success, -1 file not found

◆ userlist_remove()

int userlist_remove ( session_t session,
userlist_t u 
)

◆ userlist_remove_u()

int userlist_remove_u ( userlist_t **  userlist,
userlist_t u 
)

◆ userlist_replace()

int userlist_replace ( session_t session,
userlist_t u 
)

◆ userlist_resource_add()

ekg_resource_t* userlist_resource_add ( userlist_t u,
const char *  name,
int  prio 
)

userlist_resource_add()

It adds new user resource to resources list, with given data.

Nota
It doesn't check if prio already exists.. So you must remember about calling userlist_resource_find() if you don't want two (or more) same resources...
Parametry
u- user
name- name of resource
prio- prio of resource
Zwraca
It returns inited ekg_resource_t pointer of given data, or NULL if u was NULL

◆ userlist_resource_find()

ekg_resource_t* userlist_resource_find ( userlist_t u,
const char *  name 
)

userlist_resource_find()

It search for given resource name in user resource list u

Parametry
u- user
name- name of resource
Zwraca
It returns resource with given name if founded, otherwise NULL

◆ userlist_resource_remove()

void userlist_resource_remove ( userlist_t u,
ekg_resource_t r 
)

userlist_resource_remove()

Remove given resource r from user resource list u
Free allocated memory.

Parametry
u- user
r- resource

◆ userlist_write()

void userlist_write ( session_t session)

userlist_write()

It writes session userlist to file: session->uid-userlist in ekg2 config directory

Do zrobienia:
Each plugin should've own userlist_write()/ userlist_read() This format is obsolete.
Parametry
session
Zwraca
0 on succees
-1 if smth went wrong
-2 if we fail to create/open userlist file in rw mode

◆ userlists_destroy()

void userlists_destroy ( userlist_t **  userlist)

◆ valid_nick()

int valid_nick ( const char *  nick)

◆ valid_plugin_uid()

int valid_plugin_uid ( plugin_t plugin,
const char *  uid 
)

valid_plugin_uid()

Check if uid can be handled by given plugin

Parametry
plugin- plugin to check for
uid- uid to check for
Zobacz również
valid_uid() - if we want to know if this uid can be handled by ekg2 [when it doesn't matter which plugin]
Zwraca
1 - if uid can be handled by plugin
0 - if not
-1 - if plugin == NULL

Dokumentacja zmiennych

◆ ignore_labels

struct ignore_label ignore_labels[9]