libsrsirc  0.0.14
Lightweight, cross-platform IRC library
irc_ext.h
Go to the documentation of this file.
1 /* irc_ext.h - less commonly used part of the main interface
2  * libsrsirc - a lightweight serious IRC lib - (C) 2012-15, Timo Buhrmester
3  * See README for contact-, COPYING for license information. */
4 
5 #ifndef LIBSRSIRC_IRC_EXT_H
6 #define LIBSRSIRC_IRC_EXT_H 1
7 
8 
9 #include <stdarg.h>
10 #include <stdbool.h>
11 #include <stddef.h>
12 
13 #include <libsrsirc/defs.h>
14 #include <libsrsirc/irc.h>
15 
16 
49 const char *irc_myhost(irc *ctx);
50 
83 int irc_casemap(irc *ctx);
84 
96 bool irc_service(irc *ctx);
97 
107 const char *irc_umodes(irc *ctx);
108 
128 const char *irc_cmodes(irc *ctx);
129 
138 const char *irc_version(irc *ctx);
139 
151 const char *irc_lasterror(irc *ctx);
152 
164 const char *irc_banmsg(irc *ctx);
165 
178 bool irc_banned(irc *ctx);
179 
190 bool irc_colon_trail(irc *ctx);
191 
200 int irc_sockfd(irc *ctx);
201 
223 tokarr *(*irc_logonconv(irc *ctx))[4];
224 
250 const char *irc_005chanmodes(irc *ctx, size_t mclass);
251 
271 const char *irc_005modepfx(irc *ctx, bool symbols);
272 
287 const char *irc_005attr(irc *ctx, const char *name);
288 
301 void irc_regcb_conread(irc *ctx, fp_con_read cb, void *tag);
302 
318 void irc_regcb_mutnick(irc *ctx, fp_mut_nick mn);
319 
332 bool irc_set_ssl(irc *ctx, bool on);
333 
368 void irc_set_connect_timeout(irc *ctx, uint64_t soft, uint64_t hard);
369 
384 bool irc_set_px(irc *ctx, const char *host, uint16_t port, int ptype);
385 
394 void irc_set_conflags(irc *ctx, uint8_t flags);
395 
404 void irc_set_service_connect(irc *ctx, bool enabled);
405 
414 bool irc_set_service_dist(irc *ctx, const char *dist);
415 
422 bool irc_set_service_type(irc *ctx, long type);
423 
431 bool irc_set_service_info(irc *ctx, const char *info);
432 
456 bool irc_set_track(irc *ctx, bool on);
457 
462 const char *irc_get_host(irc *ctx);
463 
467 uint16_t irc_get_port(irc *ctx);
468 
472 const char *irc_get_px_host(irc *ctx);
473 
477 uint16_t irc_get_px_port(irc *ctx);
478 
485 int irc_get_px_type(irc *ctx);
486 
490 const char *irc_get_pass(irc *ctx);
491 
495 const char *irc_get_uname(irc *ctx);
496 
500 const char *irc_get_fname(irc *ctx);
501 
505 uint8_t irc_get_conflags(irc *ctx);
506 
511 const char *irc_get_nick(irc *ctx);
512 
516 bool irc_get_ssl(irc *ctx);
517 
521 bool irc_get_service_connect(irc *ctx);
522 
526 const char *irc_get_service_dist(irc *ctx);
527 
531 long irc_get_service_type(irc *ctx);
532 
536 const char *irc_get_service_info(irc *ctx);
537 
538 
548 bool irc_tracking_enab(irc *ctx); //tell if tracking is (actually) enabled
549  //XXX is at least the nickname tracked?
559 void irc_set_dumb(irc *ctx, bool dumbmode);
560  //XXX is at least the nickname tracked?
565 bool irc_get_dumb(irc *ctx);
566 
587 bool irc_reg_msghnd(irc *ctx, const char *cmd, uhnd_fn hndfn, bool pre);
588 
596 bool irc_eof(irc *ctx);
597 
600 #endif /* LIBSRSIRC_IRC_EXT_H */
const char * irc_005modepfx(irc *ctx, bool symbols)
Tell what channel mode prefixes the ircd claims to support.
bool irc_set_service_dist(irc *ctx, const char *dist)
Set the "distribution" string for service log on.
bool irc_colon_trail(irc *ctx)
Deprecated. Please disregard.
bool(* fp_con_read)(tokarr *msg, void *tag)
Logon-time callback for incoming protocol messages.
Definition: defs.h:200
const char * irc_banmsg(irc *ctx)
Tell why we are banned, if the server was polite enough to let us know.
void irc_set_connect_timeout(irc *ctx, uint64_t soft, uint64_t hard)
Set timeout(s) for irc_connect()
bool irc_reg_msghnd(irc *ctx, const char *cmd, uhnd_fn hndfn, bool pre)
Register a protocol message handler.
void irc_set_service_connect(irc *ctx, bool enabled)
Log on as service? if not, we&#39;re a normal client.
const char * irc_get_fname(irc *ctx)
Tell the &#39;full name&#39; we will use on the next log on.
bool irc_tracking_enab(irc *ctx)
Tell if channel- and user tracking is active.
bool irc_get_service_connect(irc *ctx)
Tell whether we&#39;ll next connect as a service.
int irc_get_px_type(irc *ctx)
Tell the type of the proxy we use or intend to use.
int irc_casemap(irc *ctx)
Tell how the IRC server maps lowercase to uppercase characters and vice-versa.
const char * irc_version(irc *ctx)
Tell what ircd version the IRC server claims to run.
void irc_regcb_mutnick(irc *ctx, fp_mut_nick mn)
Register a function to come up with an alternative nickname at logon time.
bool irc_get_dumb(irc *ctx)
Tell whether we&#39;re operating in "dumb mode".
bool irc_set_service_info(irc *ctx, const char *info)
Set the "service info" string for service log on.
uint16_t irc_get_px_port(irc *ctx)
Tell the port of the proxy we use or intend to use.
struct irc_s irc
IRC context; pointers to this are our IRC context handle type.
Definition: defs.h:144
const char * irc_lasterror(irc *ctx)
Tell what the last received ERROR message said.
const char * irc_cmodes(irc *ctx)
Lie about the available channel modes.
bool(* uhnd_fn)(irc *ctx, tokarr *msg, size_t nargs, bool pre)
User-registered protocol command callback type.
Definition: defs.h:240
int irc_sockfd(irc *ctx)
Deprecated. Please disregard.
bool irc_service(irc *ctx)
Tell whether or not we&#39;re a service (as opposed to a user).
const char * irc_005attr(irc *ctx, const char *name)
Tell the value of a given 005 attribute.
const char * irc_get_service_dist(irc *ctx)
Tell the &#39;dist&#39; string we&#39;re going to use for the next service logon.
bool irc_get_ssl(irc *ctx)
Tell whether or not we will use SSL for the next connection.
bool irc_set_px(irc *ctx, const char *host, uint16_t port, int ptype)
Set proxy server to use.
void irc_regcb_conread(irc *ctx, fp_con_read cb, void *tag)
Register callback for protocol messages that are read at logon time.
char * tokarr[18]
Field array for the parts of incoming IRC protocol messages.
Definition: defs.h:174
const char * irc_get_nick(irc *ctx)
Tell the nick we will use on the next log on.
bool irc_banned(irc *ctx)
Determine whether we are banned, if the server was polite enough to let us know.
const char * irc_get_px_host(irc *ctx)
Tell the host of the proxy we use or intend to use.
bool irc_set_ssl(irc *ctx, bool on)
Enable or disable SSL.
const char * irc_get_pass(irc *ctx)
Tell the password we may have set earlier by irc_set_pass()
uint16_t irc_get_port(irc *ctx)
Tell the port of the IRC server we use or intend to use.
long irc_get_service_type(irc *ctx)
Tell the type we&#39;re going to use for the next service logon.
const char * irc_get_host(irc *ctx)
Tell the name or address of the IRC server we use or intend to use.
bool irc_eof(irc *ctx)
Tell whether the connection was closed gracefully.
bool irc_set_service_type(irc *ctx, long type)
Set the "service type" for service log on.
const char * irc_get_uname(irc *ctx)
Tell the &#39;user name&#39; we will use on the next log on.
const char * irc_umodes(irc *ctx)
Determine the available user modes.
const char * irc_005chanmodes(irc *ctx, size_t mclass)
Tell what channel modes the ircd claims to support.
const char * irc_myhost(irc *ctx)
Tell who the IRC server claims to be.
void(* fp_mut_nick)(char *nick, size_t nick_sz)
Logon-time callback type for nickname problems.
Definition: defs.h:215
bool irc_set_track(irc *ctx, bool on)
Enable or disable channel- and user tracking.
void irc_set_conflags(irc *ctx, uint8_t flags)
Set flags for the USER message at log on time.
const char * irc_get_service_info(irc *ctx)
Tell the &#39;info&#39; string we&#39;re going to use for the next service logon.
tokarr *(* irc_logonconv(irc *ctx))[4]
Give access to the "logon conversation" (see doc/terminology.txt).
uint8_t irc_get_conflags(irc *ctx)
Tell the USER flags we will use on the next log on.
void irc_set_dumb(irc *ctx, bool dumbmode)
Set or clear "dumb mode".