ekg2
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje Grupay Strony
Struktury danych | Definicje | Definicje typów | Wyliczenia | Funkcje | Zmienne
Dokumentacja pliku commands.h
#include "dynstuff.h"
#include "plugins.h"
#include "themes.h"
#include "sessions.h"

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

Struktury danych

struct  command

Definicje

#define printq(x...)   do { if (!quiet) { print(x); } } while(0)
#define COMMAND(x)   int x(const char *name, const char **params, session_t *session, const char *target, int quiet)
#define SEND_NICKS_MAX   100

Definicje typów

typedef int command_func_t (const char *name, const char **params, session_t *session, const char *target, int quiet)
typedef struct command command_t

Wyliczenia

enum  command_flags_t {
  COMMAND_ISALIAS = 0x01, COMMAND_ISSCRIPT = 0x02, COMMAND_WITH_RESOURCE = 0x04, COMMAND_PASS_UNCHANGED = 0x08,
  COMMAND_ENABLEREQPARAMS = 0x10, COMMAND_PARAMASTARGET = 0x20, SESSION_MUSTBECONNECTED = 0x40, SESSION_MUSTBELONG = 0x80,
  SESSION_MUSTHAS = 0x100, SESSION_MUSTHASPRIVATE = 0x200, COMMAND_TARGET_VALID_UID = 0x400
}

Funkcje

command_tcommand_add (plugin_t *plugin, const char *name, char *params, command_func_t function, command_flags_t flags, char *possibilities)
int command_remove (plugin_t *plugin, const char *name)
command_tcommand_find (const char *name)
void command_init ()
void commands_remove (command_t *c)
command_tcommands_removei (command_t *c)
void commands_destroy ()
int command_exec (const char *target, session_t *session, const char *line, int quiet)
int command_exec_params (const char *target, session_t *session, int quiet, const char *command,...)
int command_exec_format (const char *target, session_t *session, int quiet, const char *format,...)
int cmd_add (const char *name, const char **params, session_t *session, const char *target, int quiet)
int cmd_alias_exec (const char *name, const char **params, session_t *session, const char *target, int quiet)
int cmd_exec (const char *name, const char **params, session_t *session, const char *target, int quiet)
int cmd_list (const char *name, const char **params, session_t *session, const char *target, int quiet)
int cmd_dcc (const char *name, const char **params, session_t *session, const char *target, int quiet)
int cmd_bind (const char *name, const char **params, session_t *session, const char *target, int quiet)
int session_command (const char *name, const char **params, session_t *session, const char *target, int quiet)
int cmd_on (const char *name, const char **params, session_t *session, const char *target, int quiet)
int cmd_metacontact (const char *name, const char **params, session_t *session, const char *target, int quiet)
int cmd_streams (const char *name, const char **params, session_t *session, const char *target, int quiet)
int cmd_script (const char *name, const char **params, session_t *session, const char *target, int quiet)
void tabnick_add (const char *nick)
void tabnick_remove (const char *nick)
int match_arg (const char *arg, char shortopt, const char *longopt, int longoptlen)

Zmienne

command_tcommands
char * send_nicks [SEND_NICKS_MAX]
int send_nicks_count
int send_nicks_index
char * last_search_first_name
char * last_search_last_name
char * last_search_nickname
char * last_search_uid

Dokumentacja definicji

#define COMMAND (   x)    int x(const char *name, const char **params, session_t *session, const char *target, int quiet)
#define printq (   x...)    do { if (!quiet) { print(x); } } while(0)
#define SEND_NICKS_MAX   100

Dokumentacja definicji typów

typedef int command_func_t(const char *name, const char **params, session_t *session, const char *target, int quiet)
typedef struct command command_t

Dokumentacja typów wyliczanych

Wartości wyliczeń:
COMMAND_ISALIAS 
COMMAND_ISSCRIPT 
COMMAND_WITH_RESOURCE 
COMMAND_PASS_UNCHANGED 
COMMAND_ENABLEREQPARAMS 
COMMAND_PARAMASTARGET 
SESSION_MUSTBECONNECTED 
SESSION_MUSTBELONG 
SESSION_MUSTHAS 
SESSION_MUSTHASPRIVATE 
COMMAND_TARGET_VALID_UID 

Dokumentacja funkcji

int cmd_add ( const char *  name,
const char **  params,
session_t session,
const char *  target,
int  quiet 
)
int cmd_alias_exec ( const char *  name,
const char **  params,
session_t session,
const char *  target,
int  quiet 
)
int cmd_bind ( const char *  name,
const char **  params,
session_t session,
const char *  target,
int  quiet 
)
int cmd_dcc ( const char *  name,
const char **  params,
session_t session,
const char *  target,
int  quiet 
)
int cmd_exec ( const char *  name,
const char **  params,
session_t session,
const char *  target,
int  quiet 
)
int cmd_list ( const char *  name,
const char **  params,
session_t session,
const char *  target,
int  quiet 
)
int cmd_metacontact ( const char *  name,
const char **  params,
session_t session,
const char *  target,
int  quiet 
)
int cmd_on ( const char *  name,
const char **  params,
session_t session,
const char *  target,
int  quiet 
)
int cmd_script ( const char *  name,
const char **  params,
session_t session,
const char *  target,
int  quiet 
)
int cmd_streams ( const char *  name,
const char **  params,
session_t session,
const char *  target,
int  quiet 
)
command_t* command_add ( plugin_t plugin,
const char *  name,
char *  params,
command_func_t  function,
command_flags_t  flags,
char *  possibilities 
)

command_add()

Add command, and make it known for ekg2.

Nota
About params XXX
flag param, there're two types of it. Informational like:
  • COMMAND_ISALIAS - When it's alias command.
  • COMMAND_ISSCRIPT - When it's script command.
    and
    Conditionals, checked at executing command @ command_exec() like: [XXX, dorobic]
  • COMMAND_ENABLEREQPARAMS -
  • COMMAND_PARAMASTARGET
  • SESSION_MUSTBECONNECTED -
  • SESSION_MUSTBELONG
  • SESSION_MUSTHAS
  • SESSION_MUSTHASPRIVATE
Parametry
plugin- plugin which handle this command
name- name of command
params- space seperated paramlist (read note for more details!)
function- function handler
flags- bitmask from commands.h (read note for more details!)
possibilities- optional space separated list of possible params.. completion useful
Zwraca
Pointer to added command_t *, or NULL if name was NULL.
int command_exec ( const char *  target,
session_t session,
const char *  line,
int  quiet 
)
int command_exec_format ( const char *  target,
session_t session,
int  quiet,
const char *  format,
  ... 
)

command_exec_format()

Format string in format and execute formated command Equivalent to:
char *tmp = saprintf(format, ...);
command_exec(target, session, tmp, quiet);
xfree(tmp);

Nota
For more details about string formating functions read man 3 vsnprintf
Zobacz również
command_exec() - If you want/can use non-formating function.. Watch for swaped params! (quiet with format)
Zwraca
0 - If format was NULL
-1 - If command was not found [It's result of command_exec()]
else it returns result of command handler.
int command_exec_params ( const char *  target,
session_t session,
int  quiet,
const char *  command,
  ... 
)
command_t* command_find ( const char *  name)
void command_init ( )
int command_remove ( plugin_t plugin,
const char *  name 
)
void commands_destroy ( )
void commands_remove ( command_t c)
command_t* commands_removei ( command_t c)
int match_arg ( const char *  arg,
char  shortopt,
const char *  longopt,
int  longoptlen 
)
int session_command ( const char *  name,
const char **  params,
session_t session,
const char *  target,
int  quiet 
)
void tabnick_add ( const char *  nick)
void tabnick_remove ( const char *  nick)

Dokumentacja zmiennych

command_t* commands
char* last_search_first_name
char* last_search_last_name
char* last_search_nickname
char* last_search_uid
char* send_nicks[SEND_NICKS_MAX]
int send_nicks_count
int send_nicks_index