libsrsirc  0.0.14
Lightweight, cross-platform IRC library
Data Structures | Typedefs | Functions
Tracking interface provided by irc_track.h

Data Structures

struct  chanrep
 Object representation of an IRC channel. More...
 
struct  userrep
 Object representation of an IRC user. More...
 

Typedefs

typedef struct chanrep chanrep
 Convenience typedef for struct chanrep. Probably a bad idea.
 
typedef struct userrep userrep
 Convenience typedef for struct userrep. Probably a bad idea.
 

Functions

size_t irc_num_chans (irc *ctx)
 Count the channels we are currently in. More...
 
size_t irc_all_chans (irc *ctx, chanrep *chanarr, size_t chanarr_cnt)
 Retrieve representations of all channels we're currently in. More...
 
chanrepirc_chan (irc *ctx, chanrep *dest, const char *name)
 Retrieve one channel representation by channel name. More...
 
bool irc_tag_chan (irc *ctx, const char *chnam, void *tag, bool autofree)
 Associate opaque user data with a channel. More...
 
size_t irc_num_users (irc *ctx)
 Count the users we are currently seeing. More...
 
size_t irc_all_users (irc *ctx, userrep *userarr, size_t userarr_cnt)
 Retrieve representations of all users we're currently seeing. More...
 
userrepirc_user (irc *ctx, userrep *dest, const char *ident)
 Retrieve one user representation by nickname. More...
 
bool irc_tag_user (irc *ctx, const char *ident, void *tag, bool autofree)
 Associate opaque user data with a user. More...
 
size_t irc_num_members (irc *ctx, const char *chnam)
 Count number of users in a given channel. More...
 
size_t irc_all_members (irc *ctx, const char *chnam, userrep *userarr, size_t userarr_cnt)
 Retrieve representations of all members of a channel. More...
 
userrepirc_member (irc *ctx, userrep *dest, const char *chnam, const char *ident)
 Retrieve one member representation by nickname and channel. More...
 
void lsi_trk_dump (irc *ctx, bool full)
 Dump tracking state for debugging purposes. More...
 

Detailed Description

Function Documentation

size_t irc_num_chans ( irc ctx)

Count the channels we are currently in.

Returns
The number of channels we are currently in.
size_t irc_all_chans ( irc ctx,
chanrep chanarr,
size_t  chanarr_cnt 
)

Retrieve representations of all channels we're currently in.

Parameters
chanarrPointer into an array of at least chanarr_cnt elements. The array is populated with the retrieved channel representations.
chanarr_cntMaximum number of channels to retrieve
Returns
The number of channels that were put into chanarr

NOTE: The information contained in the retrieved chanrep structures is only valid until the next call to irc_read()

chanrep* irc_chan ( irc ctx,
chanrep dest,
const char *  name 
)

Retrieve one channel representation by channel name.

Parameters
destPointer to a chanrep where we put the result
nameName of the channel to retrieve
Returns
A representation of channel name, or NULL if we don't know it.

NOTE: The information contained in the retrieved chanrep structure is only valid until the next call to irc_read()

bool irc_tag_chan ( irc ctx,
const char *  chnam,
void *  tag,
bool  autofree 
)

Associate opaque user data with a channel.

This is a general-purpose mechanism to associate a piece of user-defined information with a channel, called a "tag". The tag is persistent and can later be accessed using the tag member of struct chanrep.

Parameters
chnamName of the channel to tag
tagThe tag. libsrsirc does not care what exactly this is.
autofreeIf true, call free(3) on the tag when the channel is deallocated (e.g. by PARTing it)
Returns
True if the channel was tagged (false if we don't know that channel)
size_t irc_num_users ( irc ctx)

Count the users we are currently seeing.

Returns
The number of users we are currently seeing.
size_t irc_all_users ( irc ctx,
userrep userarr,
size_t  userarr_cnt 
)

Retrieve representations of all users we're currently seeing.

Parameters
userarrPointer into an array of at least userarr_cnt elements. The array is populated with the retrieved user representations.
userarr_cntMaximum number of users to retrieve
Returns
The number of users that were put into userarr

NOTE: The information contained in the retrieved userrep structures is only valid until the next call to irc_read()

userrep* irc_user ( irc ctx,
userrep dest,
const char *  ident 
)

Retrieve one user representation by nickname.

Parameters
destPointer to a userrep where we put the result
identName of the user. This can be just a nickname, or a nick!user@host-style identity.
Returns
A representation of user ident, or NULL if we don't know them.

NOTE: The information contained in the retrieved userrep structure is only valid until the next call to irc_read()

bool irc_tag_user ( irc ctx,
const char *  ident,
void *  tag,
bool  autofree 
)

Associate opaque user data with a user.

This is a general-purpose mechanism to associate a piece of user-defined information with a user, called a "tag". The tag is persistent and can later be accessed using the tag member of struct userrep.

Parameters
identName of the user to tag. This can be just a nickname, or a nick!user@host-style identity.
tagThe tag. libsrsirc does not care what exactly this is.
autofreeIf true, call free(3) on the tag when the user is deallocated (e.g. by them leaving our last common channel)
Returns
True if the user was tagged (false if we don't know that user)
size_t irc_num_members ( irc ctx,
const char *  chnam 
)

Count number of users in a given channel.

Parameters
chnamName of the channel
Returns
The number of users in channel chnam
size_t irc_all_members ( irc ctx,
const char *  chnam,
userrep userarr,
size_t  userarr_cnt 
)

Retrieve representations of all members of a channel.

Parameters
chnamName of the channel
userarrPointer into an array of at least userarr_cnt elements. The array is populated with the retrieved user representations.
userarr_cntMaximum number of users to retrieve
Returns
The number of users that were put into userarr

NOTE: The information contained in the retrieved userrep structures is only valid until the next call to irc_read()

userrep* irc_member ( irc ctx,
userrep dest,
const char *  chnam,
const char *  ident 
)

Retrieve one member representation by nickname and channel.

Parameters
destPointer to a userrep where we put the result
chnamName of the channel
identName of the user. This can be just a nickname, or a nick!user@host-style identity.
Returns
A representation of user ident in channel chnam, or NULL if we don't know the user, the channel, or the user isn't in that channel.

NOTE: The information contained in the retrieved userrep structure is only valid until the next call to irc_read()

void lsi_trk_dump ( irc ctx,
bool  full 
)

Dump tracking state for debugging purposes.

This function is intended for debugging and will puke out a dump of all tracking-related state associated with the given context

Parameters
fullDo a full dump