ekg2  GIT master
Definicje | Funkcje | Zmienne
Dokumentacja pliku gg.c
#include "ekg2.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <limits.h>
#include <unistd.h>
#include <time.h>
#include <libgadu.h>
#include "dcc.h"
#include "gg.h"
#include "misc.h"
#include "pubdir.h"
#include "images.h"
#include "pubdir50.h"
Wykres zależności załączania dla gg.c:

Definicje

#define GG_ACK_BLOCKED   0x0001
 
#define GG_ACK_MBOXFULL   0x0004
 

Funkcje

static int gg_theme_init ()
 
static void gg_session_handler_msg (session_t *s, struct gg_event *e)
 
static int gg_plugin_destroy ()
 
static int gg_session_init (void *data, va_list ap)
 
static int gg_session_deinit (void *data, va_list ap)
 
static int gg_userlist_info_handle (void *data, va_list ap)
 
static int gg_user_offline_handle (void *data, va_list ap)
 
static int gg_user_online_handle (void *data, va_list ap)
 
static int gg_status_show_handle (void *data, va_list ap)
 
uin_t str_to_uin (const char *text)
 
static int gg_add_notify_handle (void *data, va_list ap)
 
static int gg_remove_notify_handle (void *data, va_list ap)
 
static int gg_print_version (void *data, va_list ap)
 
static int gg_validate_uid (void *data, va_list ap)
 
static int gg_userlist_priv_handler (void *data, va_list ap)
 
static gint gg_ping_timer_handler (gint type, session_t *s)
 
static gint gg_inv_check_handler (gint type, gpointer data)
 
static void gg_session_handler_success (session_t *s)
 
static void gg_session_handler_failure (session_t *s, struct gg_event *e)
 
static void gg_session_handler_disconnect (session_t *s)
 
static void gg_session_handler_status (session_t *s, uin_t uin, int status, const char *descr, guint32 ip, guint16 port, int protocol)
 
static void gg_session_handler_ack (session_t *s, struct gg_event *e)
 
static void gg_session_handler_image (session_t *s, struct gg_event *e)
 
static void gg_session_handler_userlist (session_t *s, struct gg_event *e)
 
int gg_session_handler (int type, int fd, watch_type_t watch, session_t *s)
 
static void gg_changed_private (session_t *s, const char *var)
 
static void gg_changed_proxy (session_t *s, const char *var)
 
static void gg_statusdescr_handler (session_t *s, const char *varname)
 
static int gg_typing_out (void *data, va_list ap)
 
static int gg_setvar_default (void *data, va_list ap)
 
static void libgadu_debug_handler (int level, const char *format, va_list ap)
 
static gint gg_scroll_timer (gint type, gpointer data)
 
int __attribute__ ((visibility("default")))
 

Zmienne

plugin_t gg_plugin = { .name = "gg", .pclass = PLUGIN_PROTOCOL , .destroy = gg_plugin_destroy, .theme_init = gg_theme_init }
 
list_t gg_currently_checked = NULL
 
char * last_tokenid
 
int gg_config_display_token
 
int gg_config_skip_default_format
 
int gg_config_split_messages
 
int gg_config_enable_chatstates = 1
 
static plugins_params_t gg_plugin_vars []
 
static const char * gg_protocols [] = { "gg:", NULL }
 
static const status_t gg_statuses []
 
static const struct protocol_plugin_priv gg_priv
 

Dokumentacja definicji

◆ GG_ACK_BLOCKED

#define GG_ACK_BLOCKED   0x0001

◆ GG_ACK_MBOXFULL

#define GG_ACK_MBOXFULL   0x0004

Dokumentacja funkcji

◆ __attribute__()

int __attribute__ ( (visibility("default"))  )

◆ gg_add_notify_handle()

static int gg_add_notify_handle ( void *  data,
va_list  ap 
)
static

gg_add_notify_handle()

Handler for: ADD_NOTIFY
(Emited by: /add command, when you successfully add smb to the userlist)
Notify gg server about it.

Do zrobienia:
We ignore gg_add_notify_ex() result
Parametry
ap1st param: (char *) session_uid - session uid
ap2nd param: (char *) uid - user uid
dataNULL
Zwraca
1 - If smth is wrong, session_uid or uid isn't valid gg number, or session is without private struct.
else 0

◆ gg_changed_private()

static void gg_changed_private ( session_t s,
const char *  var 
)
static

gg_changed_private()

When connected, notify gg server about our privacy policy [Do we or don't we want to notify users not in our userlist about our status/description
Handler executed when session variable: "private" change.

Parametry
s- session
var- session variable name

◆ gg_changed_proxy()

static void gg_changed_proxy ( session_t s,
const char *  var 
)
static

changed_proxy()

Handler execute when session variable: "proxy" change

Błąd:
BIG XXX, Mistake at art, it should use global config variable, not session ones, because it's used to inform libgadu about proxy servers.
And libgadu has got this variables global, not session private. Maybe we somehow can update these variables before gg_login() by callng gg_changed_proxy() but now it's BAD, BAD, BAD.

◆ gg_inv_check_handler()

static gint gg_inv_check_handler ( gint  type,
gpointer  data 
)
static

◆ gg_ping_timer_handler()

static gint gg_ping_timer_handler ( gint  type,
session_t s 
)
static

◆ gg_plugin_destroy()

static int gg_plugin_destroy ( )
static

◆ gg_print_version()

static int gg_print_version ( void *  data,
va_list  ap 
)
static

gg_print_version()

Handler for: PLUGIN_PRINT_VERSION print info about libgadu version.

Zwraca
0

◆ gg_remove_notify_handle()

static int gg_remove_notify_handle ( void *  data,
va_list  ap 
)
static

gg_remove_notify_handle()

Handler for: REMOVE_NOTIFY
(Emited by: /del command, when we sucessfully remove smb from userlist.
Notify gg server about it.

Do zrobienia:
We ignore gg_remove_notify() result
Parametry
ap1st param: (char *) session_uid - session uid
ap2nd param: (char *) uid - user uid
dataNULL
Zwraca
1 - If smth is wrong, session_uid or uid isn't valid gg number, or session is without private struct.
else 0

◆ gg_scroll_timer()

static gint gg_scroll_timer ( gint  type,
gpointer  data 
)
static

◆ gg_session_deinit()

static int gg_session_deinit ( void *  data,
va_list  ap 
)
static

gg_session_deinit()

Handler for: SESSION_REMOVED
Free memory allocated by gg_private_t if session is gg one.

Parametry
ap1st param: (char *) session - uid of session
dataNULL
Do zrobienia:
Check if we really free all memory allocated by session.
Zwraca
0 if session is gg one, and memory allocated where xfree()'d.
1 if not such session, or it wasn't gg session [most probable], or we already free memory.

◆ gg_session_handler()

int gg_session_handler ( int  type,
int  fd,
watch_type_t  watch,
session_t s 
)

◆ gg_session_handler_ack()

static void gg_session_handler_ack ( session_t s,
struct gg_event *  e 
)
static

gg_session_handler_ack()

Support for messages acknowledgement.
Handler for libgadu: GG_EVENT_ACK events

◆ gg_session_handler_disconnect()

static void gg_session_handler_disconnect ( session_t s)
static

◆ gg_session_handler_failure()

static void gg_session_handler_failure ( session_t s,
struct gg_event *  e 
)
static

◆ gg_session_handler_image()

static void gg_session_handler_image ( session_t s,
struct gg_event *  e 
)
static

◆ gg_session_handler_msg()

static void gg_session_handler_msg ( session_t s,
struct gg_event *  e 
)
static

◆ gg_session_handler_status()

static void gg_session_handler_status ( session_t s,
uin_t  uin,
int  status,
const char *  descr,
guint32  ip,
guint16  port,
int  protocol 
)
static

◆ gg_session_handler_success()

static void gg_session_handler_success ( session_t s)
static

◆ gg_session_handler_userlist()

static void gg_session_handler_userlist ( session_t s,
struct gg_event *  e 
)
static

◆ gg_session_init()

static int gg_session_init ( void *  data,
va_list  ap 
)
static

gg_session_init()

Handler for: SESSION_ADDED
Init private session struct gg_private_t if session is gg one.
Read saved userlist by userlist_read()

Parametry
ap1st param: (char *) session - uid of session
dataNULL
Zwraca
0 if session is gg one, and we init memory
1 if we don't found such session, or it wasn't gg session [most probable], or we already init memory.

◆ gg_setvar_default()

static int gg_setvar_default ( void *  data,
va_list  ap 
)
static

◆ gg_status_show_handle()

static int gg_status_show_handle ( void *  data,
va_list  ap 
)
static

◆ gg_statusdescr_handler()

static void gg_statusdescr_handler ( session_t s,
const char *  varname 
)
static

◆ gg_theme_init()

static int gg_theme_init ( )
static

◆ gg_typing_out()

static int gg_typing_out ( void *  data,
va_list  ap 
)
static

◆ gg_user_offline_handle()

static int gg_user_offline_handle ( void *  data,
va_list  ap 
)
static

◆ gg_user_online_handle()

static int gg_user_online_handle ( void *  data,
va_list  ap 
)
static

◆ gg_userlist_info_handle()

static int gg_userlist_info_handle ( void *  data,
va_list  ap 
)
static

gg_userlist_info_handle()

Handler for: USERLIST_INFO
(Emited by: /list command, when we want know more about given user)
printq() all gg-protocol-only-data like: possible client version [read: which version of protocol he use], if he has voip, etc..

Parametry
ap1st param: (userlist_t *) u - item.
ap2nd param: (int) quiet - If quiet for printq()
dataNULL
Zwraca
1 - If no u passed, or it's invalid for gg plugin
else printq() info and return 0

◆ gg_userlist_priv_handler()

static int gg_userlist_priv_handler ( void *  data,
va_list  ap 
)
static

◆ gg_validate_uid()

static int gg_validate_uid ( void *  data,
va_list  ap 
)
static

gg_validate_uid()

handler for PROTOCOL_VALIDATE_UID
checks, if uid is proper for gg plugin.

Nota
Proper for gg plugin means if uid starts with "gg:" and uid len > 3
Do zrobienia:

Blah, irc does xstrncasecmp() here it's only xstrncmp() let's decide... GG: and gg: is proper, or only gg:

Maybe let's check if after gg: we have max 32b number.. because libgadu and gg protocol only support 32bit uids... ;)

Parametry
ap1st param: (char *) uid - of user/session/command/whatever
ap2nd param: (int) valid - place to put 1 if uid is valid for gg plugin.
dataNULL
Zwraca
-1 if it's valid uid for gg plugin
0 if not

◆ libgadu_debug_handler()

static void libgadu_debug_handler ( int  level,
const char *  format,
va_list  ap 
)
static

libgadu_debug_handler()

Handler for libgadu: gg_debug_handler
It's communcation channel between libgadu debug messages, and ekg2.
Here we translate libgadu levels to ekg2 one, and than pass it to ekg_debug_handler()

Parametry
level- libgadu debug level

◆ str_to_uin()

uin_t str_to_uin ( const char *  text)

Dokumentacja zmiennych

◆ gg_config_display_token

int gg_config_display_token

◆ gg_config_enable_chatstates

int gg_config_enable_chatstates = 1

◆ gg_config_skip_default_format

int gg_config_skip_default_format

◆ gg_config_split_messages

int gg_config_split_messages

◆ gg_currently_checked

list_t gg_currently_checked = NULL

◆ gg_plugin

plugin_t gg_plugin = { .name = "gg", .pclass = PLUGIN_PROTOCOL , .destroy = gg_plugin_destroy, .theme_init = gg_theme_init }

◆ gg_plugin_vars

plugins_params_t gg_plugin_vars[]
static
Wartość początkowa:
= {
{ "alias" , 0 , 0 , VAR_STR , NULL , NULL },
{ "auto_away" , "600" , 0 , VAR_INT , NULL , NULL },
{ "auto_away_descr" , 0 , 0 , VAR_STR , NULL , NULL },
{ "auto_back" , "0" , 0 , VAR_INT , NULL , NULL },
{ "auto_connect" , "0" , 0 , VAR_BOOL , NULL , NULL },
{ "auto_find" , "0" , 0 , VAR_INT , NULL , NULL },
{ "auto_reconnect" , "10" , 0 , VAR_INT , NULL , NULL },
{ "concat_multiline_status" , "3" , 0 , VAR_INT , NULL , NULL },
{ "connection_save" , "0" , 0 , VAR_INT , NULL , NULL },
{ "display_notify" , "-1" , 0 , VAR_INT , NULL , NULL },
{ "email" , 0 , 0 , VAR_STR , NULL , NULL },
{ "invisible_check_interval" , 0 , 0 , VAR_INT , NULL , NULL },
{ "local_ip" , 0 , 0 , VAR_STR , NULL , NULL },
{ "log_formats" , "xml,simple,sqlite" , 0 , VAR_STR , NULL , NULL },
{ "password" , NULL , 1 , VAR_STR , NULL , NULL },
{ "port" , "8074" , 0 , VAR_INT , NULL , NULL },
{ "private" , "0" , 0 , VAR_BOOL , gg_changed_private , NULL },
{ "protocol" , "0" , 0 , VAR_INT , NULL , NULL },
{ "proxy" , NULL , 0 , VAR_STR , gg_changed_proxy , NULL },
{ "proxy_forwarding" , NULL , 0 , VAR_STR , NULL , NULL },
{ "scroll_long_desc" , "0" , 0 , VAR_INT , NULL , NULL },
{ "scroll_mode" , "bounce" , 0 , VAR_STR , NULL , NULL },
{ "server" , NULL , 0 , VAR_STR , NULL , NULL },
{ "statusdescr" , NULL , 0 , VAR_STR , gg_statusdescr_handler , NULL },
{ NULL, NULL, 0, -1, NULL }
}
static void gg_changed_private(session_t *s, const char *var)
Definition: gg.c:1441
Definition: vars.h:35
Definition: vars.h:33
#define NULL
Definition: oralog.c:49
static void gg_statusdescr_handler(session_t *s, const char *varname)
Definition: gg.c:1517
static void gg_changed_proxy(session_t *s, const char *var)
Definition: gg.c:1473
Definition: vars.h:34

◆ gg_priv

const struct protocol_plugin_priv gg_priv
static
Wartość początkowa:
= {
.protocols = gg_protocols,
.statuses = gg_statuses
}
static const char * gg_protocols[]
Definition: gg.c:1683
static const status_t gg_statuses[]
Definition: gg.c:1684

◆ gg_protocols

const char* gg_protocols[] = { "gg:", NULL }
static

◆ gg_statuses

const status_t gg_statuses[]
static
Wartość początkowa:
= {
}
Definition: sessions.h:40
Definition: sessions.h:55
Definition: sessions.h:51
Definition: sessions.h:58
Definition: sessions.h:44
Definition: sessions.h:48

◆ last_tokenid

char* last_tokenid