IRCBot Plugin API  v5
Public Types | Public Attributes | List of all members
USER_PRESENCE Struct Reference

#include <plugins.h>

Public Types

typedef bool(* userPresSendFunc )(USER_PRESENCE *, const char *)
 This is the function prototype for std_reply/send_msg/send_chan/etc. More...
 

Public Attributes

USERUser
 A ptr to a USER structure if the person here matched a hostmask and is an IRCBot user, or NULL if it isn't an IRCBot user. More...
 
const char * Nick
 The user's username/nick. More...
 
const char * Hostmask
 The user's hostmask. More...
 
uint32 Flags
 The user's flags. More...
 
int NetNo
 The network # if applicable (for multiple server protocols like IRC), -1 otherwise. More...
 
const char * Channel
 If presence was caused by something in a channel/group, it will be here, otherwise it will be NULL. More...
 
const char * Desc
 Description of the medium this presence is on. ie. IRC, Jabber, etc. More...
 
union {
   T_SOCKET *   Sock
 Data for the USER_PRESENCE provider, a socket. More...
 
   void *   Ptr1
 Data for the USER_PRESENCE provider, ptr to their own data structure. More...
 
}; 
 
userPresSendFunc std_reply
 This is for a command reply to simplify code for IRC. If the user said something in the channel to activate this USER_PRESENCE, it will NOTICE them, otherwise it will PRIVMSG them. More...
 
userPresSendFunc send_chan
 Send a message to the channel the user is in (ONLY valid if Channel != NULL) More...
 
userPresSendFunc send_chan_notice
 Send a NOTICE to the channel the user is in (ONLY valid if Channel != NULL) More...
 
userPresSendFunc send_msg
 Send a PRIVMSG to the user. More...
 
userPresSendFunc send_notice
 Send a NOTICE to the user. On protocols where there is no distinction between notices, PMs, etc., it will be the same as send_msg. More...
 
void(* ref )(USER_PRESENCE *pres)
 
void(* unref )(USER_PRESENCE *pres)
 
uint32 ref_cnt
 DO NOT TOUCH!!! Only the ref and unref commands should alter ref_cnt. More...
 

Detailed Description

The USER_PRESENCE structure represents a communications handle to a user that is protocol agnostic. This allows bot commands to be implemented one time and work for every protocol we support and future protocols without rewriting or reimplementing for each one. All pointer fields in this structure should not be modified by the programmer because duplicate presences are shared to reduce memory usage.

Member Typedef Documentation

typedef bool(* USER_PRESENCE::userPresSendFunc)(USER_PRESENCE *, const char *)

This is the function prototype for std_reply/send_msg/send_chan/etc.

Member Data Documentation

USER* USER_PRESENCE::User

A ptr to a USER structure if the person here matched a hostmask and is an IRCBot user, or NULL if it isn't an IRCBot user.

const char* USER_PRESENCE::Nick

The user's username/nick.

const char* USER_PRESENCE::Hostmask

The user's hostmask.

uint32 USER_PRESENCE::Flags

The user's flags.

See also
USER::Flags
int USER_PRESENCE::NetNo

The network # if applicable (for multiple server protocols like IRC), -1 otherwise.

const char* USER_PRESENCE::Channel

If presence was caused by something in a channel/group, it will be here, otherwise it will be NULL.

const char* USER_PRESENCE::Desc

Description of the medium this presence is on. ie. IRC, Jabber, etc.

T_SOCKET* USER_PRESENCE::Sock

Data for the USER_PRESENCE provider, a socket.

void* USER_PRESENCE::Ptr1

Data for the USER_PRESENCE provider, ptr to their own data structure.

union { ... }
userPresSendFunc USER_PRESENCE::std_reply

This is for a command reply to simplify code for IRC. If the user said something in the channel to activate this USER_PRESENCE, it will NOTICE them, otherwise it will PRIVMSG them.

userPresSendFunc USER_PRESENCE::send_chan

Send a message to the channel the user is in (ONLY valid if Channel != NULL)

userPresSendFunc USER_PRESENCE::send_chan_notice

Send a NOTICE to the channel the user is in (ONLY valid if Channel != NULL)

userPresSendFunc USER_PRESENCE::send_msg

Send a PRIVMSG to the user.

userPresSendFunc USER_PRESENCE::send_notice

Send a NOTICE to the user. On protocols where there is no distinction between notices, PMs, etc., it will be the same as send_msg.

void(* USER_PRESENCE::ref)(USER_PRESENCE *pres)

This command increases the reference count of the USER_PRESENCE structure. Use this anytime you need to hang on to a copy of the structure.
Do not call this function directly, instead use RefUser() on the USER_PRESENCE structure ptr.
Note: It is the responsiblity of this function to RefUser() the User member (if non-NULL), so you don't have to do it seperately.

Parameters
presa ptr to a valid USER_PRESENCE structure
void(* USER_PRESENCE::unref)(USER_PRESENCE *pres)

This command decreases the reference count of the USER_PRESENCE structure and deletes it when it reaches zero. Use this when you are done with a structure you have RefUser'ed (or gotten from a call that RefUser'ed it)
Do not call this function directly, instead use UnrefUser() on the USER_PRESENCE structure ptr.
Note: It is the responsiblity of this function to UnrefUser() the User member (if non-NULL), so you don't have to do it seperately.

Parameters
presa ptr to a valid USER_PRESENCE structure
uint32 USER_PRESENCE::ref_cnt

DO NOT TOUCH!!! Only the ref and unref commands should alter ref_cnt.


The documentation for this struct was generated from the following file: