IRCBot Plugin API  v5
plugins.h
Go to the documentation of this file.
1 #ifndef __INCLUDE_IRCBOT_PLUGINS_H__
2 #define __INCLUDE_IRCBOT_PLUGINS_H__
3 
4 #define IRCBOT_PLUGIN_VERSION 0x0E
5 #define IRCBOT_VERSION_FLAG_DEBUG 0x00000001
6 #define IRCBOT_VERSION_FLAG_LITE 0x00000002
7 //#define IRCBOT_VERSION_FLAG_BASIC 0x00000004
8 //#define IRCBOT_VERSION_FLAG_FULL 0x00000008
9 //#define IRCBOT_VERSION_FLAG_STANDALONE 0x00000010
10 
11 //#define _USE_32BIT_TIME_T
12 #ifndef NO_DSL
13 #include "../../Common/ircbot-config.h"
14 #include <drift/dsl.h>
15 #else
16  // DSL types
17  #if defined(WIN32) || defined(XBOX)
18  #include <winsock2.h>
19  #include <windows.h>
20  typedef int socklen_t;
21  typedef signed __int64 int64;
22  typedef unsigned __int64 uint64;
23  typedef signed __int32 int32;
24  typedef unsigned __int32 uint32;
25  typedef signed __int16 int16;
26  typedef unsigned __int16 uint16;
27  typedef signed __int8 int8;
28  typedef unsigned __int8 uint8;
29  #define DL_HANDLE HINSTANCE
30  #define DSL_CC __stdcall
31  #else
32  #define VOID void
33  #ifndef SOCKET
34  #define SOCKET int
35  #endif
36  #define BYTE unsigned char
37  #ifndef HANDLE
38  #define HANDLE void *
39  #endif
40  #define DL_HANDLE HANDLE
41  typedef signed long long int64;
42  typedef unsigned long long uint64;
43  typedef signed int int32;
44  typedef unsigned int uint32;
45  typedef signed short int16;
46  typedef unsigned short uint16;
47  typedef signed char int8;
48  typedef unsigned char uint8;
49  #define DSL_CC
50  #endif
51  typedef void * T_SOCKET;
52  typedef void * DS_CONFIG_SECTION;
53 #endif
54 #define SQLITE3_DLL
55 #include <sqlite3.h>
56 #include <curl/curl.h>
57 //#include <tcl.h>
58 #include <string>
59 #include <map>
60 #include <iostream>
61 using namespace std;
62 #undef SendMessage
63 
64 #if defined(WIN32)
65  #define PLUGIN_EXPORT extern "C" __declspec(dllexport)
66  #define DEPRECATE __declspec(deprecated)
67 #else
68  #if defined(HAVE_VIS)
69  #define PLUGIN_EXPORT extern "C" __attribute__ ((visibility("default")))
70  #else
71  #define PLUGIN_EXPORT extern "C"
72  #endif
73  #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
74  #define DEPRECATE __attribute__((__deprecated__))
75  #else
76  #define DEPRECATE
77  #endif /* __GNUC__ */
78 #endif
79 #define PLUGIN_EXPORT_NAME GetIRCBotPlugin
80 #define PLUGIN_EXPORT_FULL PLUGIN_EXPORT PLUGIN_PUBLIC * PLUGIN_EXPORT_NAME() { return &plugin; }
81 
82 #define MAX_IRC_SERVERS 16
83 #define MAX_IRC_CHANNELS 16
84 #define MAX_PLUGINS 32
85 #define MAX_SOUND_SERVERS 32
86 #define MAX_HOSTMASKS 16
87 #define MAX_TIMERS 32
88 
89 #include "common_messages.h"
90 #include "user_flags.h"
91 #include "../../Common/remote_protocol.h"
92 
129 enum SS_TYPES {
135 };
136 
137 #define REF_TRACKING_DEPTH 16
138 
139 #if !defined(DEBUG)
140 #define RefUser(x) (x)->ref(x)
141 #define UnrefUser(x) (x)->unref(x)
142 #else
143 #define RefUser(x) (x)->ref(x, nopathA(__FILE__), __LINE__)
144 #define UnrefUser(x) (x)->unref(x, nopathA(__FILE__), __LINE__)
145 #endif
146 
154 struct USER {
155  char Nick[128];
156  char Pass[128];
157  char LastHostmask[256];
158 
160  bool Temporary;
161  time_t Created;
162  time_t Seen;
163 
165  char Hostmasks[MAX_HOSTMASKS][128];
166 
167 #if !defined(DEBUG)
168 
173  void (*ref)(USER * user);
179  void (*unref)(USER * user);
180 #else
181  void (*ref)(USER *, const char * fn, int line);
182  void (*unref)(USER *, const char * fn, int line);
183 
184  char * fn[REF_TRACKING_DEPTH];
185  int line[REF_TRACKING_DEPTH];
186 #endif
188 };
189 
197  USER * User;
198 
199  /* Some duplication of data here, but necessary for cases where User == NULL and for times when a persons nick != their username */
200  const char * Nick;
201  const char * Hostmask;
203  int NetNo;
204  const char * Channel;
205 
206  const char * Desc;
207 
208  union {
210  void * Ptr1;
211  };
212 
213  typedef bool (*userPresSendFunc)(USER_PRESENCE *, const char *);
214  userPresSendFunc std_reply;
215  userPresSendFunc send_chan;
216  userPresSendFunc send_chan_notice;
217  userPresSendFunc send_msg;
218  userPresSendFunc send_notice;
219 
220 #if !defined(DEBUG)
221 
227  void (*ref)(USER_PRESENCE * pres);
234  void (*unref)(USER_PRESENCE * pres);
235 #else
236  void (*ref)(USER_PRESENCE *, const char * fn, int line);
237  void (*unref)(USER_PRESENCE *, const char * fn, int line);
238 #endif
240 };
241 
242 #ifndef SWIG
243 
244 typedef int (*CommandProcType)(const char * command, const char * parms, USER_PRESENCE * ut, uint32 type);
245 
253 struct COMMAND_ACL {
257 };
258 
263 struct COMMAND {
264  const char * command;
265 #if defined(OLD_COMTRACK)
266  COMMAND *Prev,*Next;
267 #endif
268  const char * desc;
270  union {
271  const char * action;
273  };
277  int plugin;
279 };
280 #endif
281 
282 #define COMMAND_ACTION 0x00
283 #define COMMAND_PROC 0x01
284 #define CM_ALLOW_IRC_PUBLIC 0x00000001
285 #define CM_ALLOW_IRC_PRIVATE 0x00000002
286 #define CM_ALLOW_CONSOLE_PUBLIC 0x00000004
287 #define CM_ALLOW_CONSOLE_PRIVATE 0x00000008
288 #define CM_FLAG_FROM_TEXT 0x20000000
289 #define CM_FLAG_SLOW 0x10000000
290 #define CM_FLAG_ASYNC 0x40000000
291 #define CM_FLAG_NOHANG 0x80000000
292 #define CM_NO_FLAGS(x) (x & 0x0000000F)
293 
294 #define CM_ALLOW_ALL_PUBLIC CM_ALLOW_IRC_PUBLIC|CM_ALLOW_CONSOLE_PUBLIC
295 #define CM_ALLOW_ALL_PRIVATE CM_ALLOW_IRC_PRIVATE|CM_ALLOW_CONSOLE_PRIVATE
296 #define CM_ALLOW_ALL CM_ALLOW_ALL_PUBLIC|CM_ALLOW_ALL_PRIVATE
297 
300 #ifndef SWIG
301 
310 };
311 #endif
312 
313 #ifdef SWIG
314 %immutable;
315 #endif
316 
323 typedef struct {
324  char host[128];
325  char mount[128];
326  char admin_pass[128];
329  bool has_source;
330 } SOUND_SERVER;
331 
337 typedef struct {
338  bool online;
340  int bitrate;
342  int peak;
343  int maxusers;
344 
345  char curdj[128];
346  char lastdj[128];
347  char cursong[512];
348 } STATS;
349 
357 struct SONG_RATING {
360 };
361 
365 #define MAX_FIND_RESULTS 100
366 
372 struct FIND_RESULT {
373  char * fn;
375 };
381 struct FIND_RESULTS {
382  char query[128];
383  int start;
384 
387  bool have_more;
388 
389  int plugin;
390  void (*free)(FIND_RESULTS * res);
391 };
392 typedef void (*find_finish_type)(USER_PRESENCE * ut, FIND_RESULTS * qRes, int max);
401  void (*find)(const char * fn, int max_results, int start, USER_PRESENCE * ut, find_finish_type find_finish);
402  bool (*request_from_find)(USER_PRESENCE * pres, FIND_RESULT * res, char * reply, size_t replySize);
403  bool (*request)(USER_PRESENCE * pres, const char * txt, char * reply, size_t replySize);
404 };
405 
406 #ifdef SWIG
407 %mutable;
408 #endif
409 
410 #ifndef SWIG
411 #ifndef DOXYGEN_SKIP
412 
413 #endif // DOXYGEN_SKIP
414 
418 typedef struct {
426  int (*replace)(char * str, int32 bufsize, const char *findstr, const char * replstr);
427  char * (*trim)(char *buf, const char * strtrim);
428  char * (*duration)(uint32 num, char * buf);
429  int32 (*decode_duration)(const char * buf);
430  int (*wildcmp)(const char *wild, const char *string);
431  int (*wildicmp)(const char *wild, const char *string);
432  bool (*get_range)(const char * buf, int32 * imin, int32 * imax);
433 } API_textfunc;
434 
441 typedef struct {
442  COMMAND * (*FindCommand)(const char * command);
443  COMMAND * (*RegisterCommand_Action)(int pluginnum, const char * command, const COMMAND_ACL * acl, uint32 mask, const char * action, const char * desc);
444 
453  COMMAND * (*RegisterCommand_Proc)(int pluginnum, const char * command, const COMMAND_ACL * acl, uint32 mask, CommandProcType proc, const char * desc);
454  void (*UnregisterCommandsByPlugin)(int pluginnum);
455  void (*UnregisterCommandByName)(const char * command);
456  void (*UnregisterCommand)(COMMAND * command);
457 
458  char (*PrimaryCommandPrefix)();
459  bool (*IsCommandPrefix)(char ch);
460  COMMAND_ACL * (*FillACL)(COMMAND_ACL * acl, uint32 flags_have_all, uint32 flags_have_any, uint32 flags_not);
461  COMMAND_ACL (*MakeACL)(uint32 flags_have_all, uint32 flags_have_any, uint32 flags_not);
462 
463  int (*ExecuteProc)(COMMAND * com, const char * parms, USER_PRESENCE * ut, uint32 type);
464  void (*RegisterCommandHook)(const char * command, CommandProcType hook_func);
465  void (*UnregisterCommandHook)(const char * command, CommandProcType hook_func);
466 } API_commands;
467 
468 #ifndef DOXYGEN_SKIP
469 // case-independent (ci) string less_than
470 // returns true if s1 < s2
471 struct ci_less : binary_function<string, string, bool> {
472 
473  // case-independent (ci) compare_less binary function
474  struct nocase_compare : public binary_function<unsigned char,unsigned char,bool>
475  {
476  bool operator() (const unsigned char& c1, const unsigned char& c2) const
477  { return tolower (c1) < tolower (c2); }
478  };
479 
480  bool operator() (const string & s1, const string & s2) const
481  {
482 
483  return lexicographical_compare
484  (s1.begin (), s1.end (), // source range
485  s2.begin (), s2.end (), // dest range
486  nocase_compare ()); // comparison
487  }
488 }; // end of ci_less
489 
490 typedef std::map<std::string, std::string, ci_less> sql_row;
491 typedef std::map<int, sql_row> sql_rows;
492 #endif /* DOXYGEN_SKIP */
493 
501 typedef struct {
502  sqlite3 * (*GetHandle)();
503  int (*Query)(const char * query, sqlite3_callback cb, void * parm, char ** error);
504  void (*Free)(char * ptr);
505  int (*GetTable)(const char * query, char ***resultp, int *nrow, int *ncolumn, char **errmsg);
506  const char * (*GetTableEntry)(int row, int col, char **result, int nrow, int ncol);
507  void (*FreeTable)(char **result);
508  char * (*MPrintf)(const char* fmt,...);
509  void (*Lock)();
510  void (*Release)();
511  int64 (*InsertID)();
512 } API_db;
513 
519 typedef struct {
520  CURL * (*easy_init)(void);
521  CURLcode (*easy_setopt)(CURL *curl, CURLoption option, ...);
522  CURLcode (*easy_perform)(CURL *curl);
523  void (*easy_cleanup)(CURL *curl);
524  const char * (*easy_strerror)(CURLcode);
525  CURLcode (*easy_getinfo)(CURL *curl, CURLINFO info, ...);
526 
527  CURLM * (*multi_init)(void);
528  CURLMcode (*multi_add_handle)(CURLM *multi_handle, CURL *curl_handle);
529  CURLMcode (*multi_remove_handle)(CURLM *multi_handle, CURL *curl_handle);
530  CURLMcode (*multi_perform)(CURLM *multi_handle, int *running_handles);
531  CURLMcode (*multi_cleanup)(CURLM *multi_handle);
532  CURLMsg * (*multi_info_read)(CURLM *multi_handle, int *msgs_in_queue);
533  const char * (*multi_strerror)(CURLMcode);
534 
535  CURLFORMcode (*formadd)(struct curl_httppost **httppost, struct curl_httppost **last_post, ...);
536  void (*formfree)(struct curl_httppost *form);
537 
538  struct curl_slist * (*slist_append)(struct curl_slist *, const char *);
539  void (*slist_free_all)(struct curl_slist *);
540 
541  char * (*escape)(const char *string, int length);
542  char * (*unescape)(const char *string, int length);
543 
544  void (*free)(void *p);
545 } API_curl;
546 
551 typedef struct {
552  void * (DSL_CC * alloc)(uint32 lSize, const char * file, int line);
553  void * (DSL_CC *realloc)(void * ptr, uint32 lSize, const char * file, int line);
554  char * (DSL_CC *strdup)(const char * ptr, const char * file, int line);
555  wchar_t * (DSL_CC *wcsdup)(const wchar_t * ptr, const char * file, int line);
556  void (DSL_CC *free)(void * ptr, const char * file, int line);
557  char * (DSL_CC *mprintf)(const char * ptr, ...);
558 } API_memory;
559 
564 typedef struct {
565  bool (*is_nick_in_chan)(int netno, const char * chan, const char * nick);
566  bool (*is_bot_in_chan)(int netno, const char * chan);
567  int (*num_nicks_in_chan)(int netno, const char * chan);
568  bool (*get_nick_in_chan)(int netno, const char * chan, int num, char * nick, int nickSize);
569 } API_ial;
570 
571 
572 typedef bool (*EnumUsersByLastHostmaskCallback)(USER * user, void * ptr);
573 
580 typedef struct {
586  USER * (*GetUser)(const char * hostmask);
592  USER * (*GetUserByNick)(const char * nick);
593  bool (*IsValidUserName)(const char * nick);
594  uint32 (*GetUserCount)();
595 
596  void (*EnumUsersByLastHostmask)(EnumUsersByLastHostmaskCallback callback, const char * hostmask, void * ptr);
597 
598  uint32 (*GetUserFlags)(const char * hostmask);
599  USER * (*AddUser)(const char * nick, const char * pass, uint32 flags, bool temp);
600  void (*SetUserFlags)(USER * user, uint32 flags);
601  void (*AddUserFlags)(USER * user, uint32 flags);
602  void (*DelUserFlags)(USER * user, uint32 flags);
603 
604  uint32 (*GetDefaultFlags)();
605 
612  bool (*uflag_have_any_of)(uint32 flags, uint32 wanted);
619  int (*uflag_compare)(uint32 flags1, uint32 flags2);
626  void (*uflag_to_string)(uint32 flags, char * buf, size_t bufSize);
639  uint32 (*string_to_uflag)(const char * buf, uint32 cur);
640 
653  bool (*Mask)(const char * hostmask, char * msgbuf, size_t bufSize, int type);
654 
655  uint32 (*GetLevelFlags)(int level);
656  void (*SetLevelFlags)(int level, uint32 flags);
657 } API_user;
658 
664 typedef struct {
672  DS_CONFIG_SECTION * (*GetConfigSection)(DS_CONFIG_SECTION * parent, const char * name);
682  bool (*GetConfigSectionValueBuf)(DS_CONFIG_SECTION * section, const char * name, char * buf, size_t bufSize);
691  char * (*GetConfigSectionValue)(DS_CONFIG_SECTION * section, const char * name);
699  long (*GetConfigSectionLong)(DS_CONFIG_SECTION * section, const char * name);
707  double (*GetConfigSectionFloat)(DS_CONFIG_SECTION * section, const char * name);
715  bool (*IsConfigSectionValue)(DS_CONFIG_SECTION * section, const char * name);
716 } API_config;
717 
723 typedef struct {
725  char key[68];
726 } YP_HANDLE;
727 
733 typedef struct {
734  const char * source_name;
735  const char * mime_type;
736  const char * cur_playing;
737  const char * genre;
739 
745 typedef struct {
756  bool (*AddToYP)(YP_HANDLE * yp, SOUND_SERVER * sc, YP_CREATE_INFO * ypinfo);
764  int (*TouchYP)(YP_HANDLE * yp, const char * cur_playing);
770  void (*DelFromYP)(YP_HANDLE * yp);
771 } API_yp;
772 
777 enum {
783 };
784 
789 typedef struct {
790  bool (*LogToChan)(const char * buf);
791 
800  int (*SendIRC_Priority)(int32 netno, const char * buf, int32 datalen, uint8 priority);
811  int (*SendIRC_Delay)(int32 netno, const char * buf, int32 datalen, uint8 priority, uint32 delay);
821  int DEPRECATE (*SendSock_Priority)(T_SOCKET * sock, const char * buf, int32 datalen, uint8 priority, uint32 delay);
822  void DEPRECATE (*ClearSockEntries)(T_SOCKET * sock);
823  // ^- I don't think anything uses these 2 anymore in plugins, but they could potentially be used in command handlers as long as you verify they are IRC connections.
824 
825  bool (*GetDoSpam)();
826  void (*SetDoSpam)(bool dospam);
827  void (*SetDoSpamChannel)(bool dospam, int netno, const char * chan);
828  void (*SetDoOnJoin)(bool doonjoin);
829  void (*SetDoOnJoinChannel)(bool doonjoin, int netno, const char * chan);
830 
836  const char *(*GetCurrentNick)(int32 net);
842  const char *(*GetDefaultNick)(int32 net);
843  int (*NumNetworks)();
844  bool (*IsNetworkReady)(int32 num);
845 } API_irc;
846 
853 };
854 #define REQUESTS_ON(x) (x >= REQ_MODE_NORMAL)
855 #define HAVE_DJ(x) (x >= REQ_MODE_DJ_NOREQ)
856 
857 typedef struct {
866  int (*GetSSInfo)(int32 ssnum, SOUND_SERVER * ss);
867  STATS * (*GetStreamInfo)();
868  REQUEST_MODES (*GetRequestMode)();
869  void (*EnableRequests)(bool activate);
870  void (*EnableRequestsHooked)(REQUEST_INTERFACE *);
871 
872  bool (*AreRatingsEnabled)();
873  int (*GetMaxRating)();
874  void (*RateSongByID)(uint32 id, const char * nick, uint32 rating);
875  void (*RateSong)(const char * song, const char * nick, uint32 rating);
876  void (*GetSongRatingByID)(uint32 id, SONG_RATING * r);
877  void (*GetSongRating)(const char * song, SONG_RATING * r);
878 } API_ss;
879 
880 struct BOTAPI;
881 typedef struct {
882  unsigned char plugin_ver;
883 
884  char * guid;
887  char * plugin_author;
888 
895  int (*init)(int num, BOTAPI * BotAPI);
896 
900  void (*quit)();
901 
911  int (*message)(unsigned int msg, char * data, int datalen);
912 
921  int (*on_text)(USER_PRESENCE * ut, const char * msg);
922 
931  int (*on_notice)(USER_PRESENCE * ut, const char * msg);
932 
940  int (*raw)(int netno, char * msg);
941 
951  int (*remote)(USER_PRESENCE * ut, unsigned char cliversion, REMOTE_HEADER * head, char * data);
952 
953  //filled in by IRCBot for you
955 
956  //for use only by IRCBot
958 } PLUGIN_PUBLIC;
959 
960 struct BOTAPI {
961  uint32 (*GetVersion)();
962  const char * (*GetVersionString)();
963  const char * (*GetIP)();
964  const char * platform;
965 #if defined(WIN32)
966  HWND hWnd;
967 #else
968  void * unused;
969 #endif
970 
971  const char * (*GetBasePath)();
972  char * (*GetBindIP)(char * buf, size_t bufSize);
973  int (*get_argc)();
974  const char * (*get_argv)(int i);
975  int64 (*get_cycles)();
976  void (*ib_printf2)(int pluginnum, const char * fmt, ...);
977  void (*Rehash)(const char * fn);
978 
979  int (*NumPlugins)();
980  PLUGIN_PUBLIC * (*GetPlugin)(int32 plugnum);
981  bool (*LoadPlugin)(const char * fn);
982 
990  bool (*LoadMessage)(const char * name, char * msgbuf, int32 bufSize);
999  void (*ProcText)(char * text, int32 bufSize);
1000  void (*SetCustomVar)(const char * name, const char * val);
1001  void (*DeleteCustomVar)(const char * name);
1002  void (*BroadcastMsg)(USER_PRESENCE * ut, const char * buf);
1003 
1009  const char * (*GetLangString)(const char * str);
1010 
1011  void (*safe_sleep_seconds)(int32 sleepfor);
1012  void (*safe_sleep_milli)(int32 sleepfor);
1013  uint32 (*genrand_int32)();
1014  int (*get_rand)(int min, int max);
1015 
1016  void (*SendRemoteReply)(T_SOCKET * socket, REMOTE_HEADER * rHead, const char * data);
1017  int (*SendMessage)(int toplug, uint32 MsgID, char * data, int32 datalen);
1018 
1028 
1029 #if !defined(IRCBOT_LITE)
1032 #else
1033  void * unused_lite[2];
1034 #endif
1035 };
1036 
1041 #define SendIRC(x,y,z) SendIRC_Priority(x,y,z,PRIORITY_DEFAULT)
1042 
1046 #define SendSock(x,y,z) SendSock_Priority(x,y,z,PRIORITY_DEFAULT)
1047 
1048 #if !defined(__INCLUDE_IRCBOT_MAIN_H__)
1049  #define BOTAPI_DEF BOTAPI
1050  #define API_SS SOUND_SERVER
1051  #if defined(_ADJ_PLUGIN_H_) && !defined(_AUTODJ_)
1052  #define _(x) api->botapi->GetLangString(x)
1053  #define ib_printf(x, ...) ib_printf2(api->GetPluginNum(), x, ##__VA_ARGS__)
1054  #elif defined(_SDJ_PLUGIN_H_) && !defined(_SIMPLEDJ_)
1055  #define _(x) api->botapi->GetLangString(x)
1056  #define ib_printf(x, ...) ib_printf2(api->GetPluginNum(), x, ##__VA_ARGS__)
1057  #else
1058  #define _(x) api->GetLangString(x)
1059  #define ib_printf(x, ...) ib_printf2(pluginnum, x, ##__VA_ARGS__)
1060  #endif
1061 
1062  /*
1063  #define zmalloc(x) api->mem->alloc(x,__FILE__,__LINE__)
1064  #define zrealloc(x,y) api->mem->realloc(x,y,__FILE__,__LINE__)
1065  #define zfree(x) api->mem->free(x,__FILE__,__LINE__)
1066  #define zstrdup(x) api->mem->strdup(x,__FILE__,__LINE__)
1067  #define znew(x) (x *)api->mem->alloc(sizeof(x), __FILE__, __LINE__)
1068  #define zfreenn(ptr) if (ptr) { api->mem->free(ptr, __FILE__, __LINE__); }
1069  #define zmprintf api->mem->mprintf
1070  */
1071 #endif
1072 
1073 #endif // SWIG
1074 
1075 #endif // __INCLUDE_IRCBOT_PLUGINS_H__
Definition: plugins.h:848
Definition: plugins.h:779
time_t Created
When the user was created (only persistent for non-temporary users)
Definition: plugins.h:161
Definition: plugins.h:857
void * T_SOCKET
Definition: plugins.h:51
unsigned char plugin_ver
The bot binary ABI identifier, you should always set this to IRCBOT_PLUGIN_VERSION instead of setting...
Definition: plugins.h:882
bool has_source
Does this sound server have a source connected to it? (ie. is there a stream active right now) ...
Definition: plugins.h:329
Definition: plugins.h:441
signed int int32
Definition: plugins.h:43
#define DL_HANDLE
Definition: plugins.h:40
API_ss * ss
Definition: plugins.h:1031
const char * Hostmask
The user's hostmask.
Definition: plugins.h:201
COMMAND_ACL acl
The flags needed (and not allowed) to use this command.
Definition: plugins.h:275
uint32 ref_cnt
DO NOT TOUCH!!! Only the ref and unref commands should alter ref_cnt.
Definition: plugins.h:187
Definition: plugins.h:723
CommandProcType proc
The command handler (if proc_type == COMMAND_PROC)
Definition: plugins.h:272
uint32 ref_cnt
DO NOT TOUCH!!!
Definition: plugins.h:278
const char * Nick
The user's username/nick.
Definition: plugins.h:200
REQUEST_MODES
Definition: plugins.h:847
signed short int16
Definition: plugins.h:45
void * DS_CONFIG_SECTION
Definition: plugins.h:52
userPresSendFunc send_chan_notice
Send a NOTICE to the channel the user is in (ONLY valid if Channel != NULL)
Definition: plugins.h:216
void * Ptr1
Data for the USER_PRESENCE provider, ptr to their own data structure.
Definition: plugins.h:210
uint32 flags_any
user must have at least one of these to be allowed
Definition: plugins.h:255
int num_songs
Definition: plugins.h:386
Definition: plugins.h:307
unsigned char uint8
Definition: plugins.h:48
int bitrate
Definition: plugins.h:340
int NetNo
The network # if applicable (for multiple server protocols like IRC), -1 otherwise.
Definition: plugins.h:203
uint32 flags_not
user cannot have any of these flags and be allowed
Definition: plugins.h:256
#define REF_TRACKING_DEPTH
Definition: plugins.h:137
char * fn
At a minimum fn must be set so the bot has something to display. The bot will automatically show only...
Definition: plugins.h:373
uint32 yp_id
Definition: plugins.h:724
void * private_struct
Definition: plugins.h:957
Definition: plugins.h:323
const char * Desc
Description of the medium this presence is on. ie. IRC, Jabber, etc.
Definition: plugins.h:206
char * plugin_name_short
The short name of your plugin, it should be 3 or less words and NOT have a version number or anything...
Definition: plugins.h:885
unsigned short uint16
Definition: plugins.h:46
Definition: plugins.h:400
REMOTE_COMMANDS cmd
The command to execute, or reply if from the bot to client.
Definition: plugins.h:308
Definition: plugins.h:253
void * unused
Definition: plugins.h:968
const char * source_name
Definition: plugins.h:734
#define DEPRECATE
Definition: plugins.h:76
Definition: plugins.h:778
Definition: plugins.h:357
SS_TYPES
Definition: plugins.h:129
Definition: plugins.h:960
int peak
Definition: plugins.h:342
const char * command
A string containing the command name.
Definition: plugins.h:264
Definition: plugins.h:154
Definition: plugins.h:263
uint32 Rating
The song rating from 0-5 (0 = not rated)
Definition: plugins.h:358
Definition: plugins.h:551
void(* find_finish_type)(USER_PRESENCE *ut, FIND_RESULTS *qRes, int max)
Definition: plugins.h:392
#define DSL_CC
Definition: plugins.h:49
char * guid
The unique GUID for your plugin. It should be in "registry" format, and please use a real GUID genera...
Definition: plugins.h:884
uint32 ref_cnt
DO NOT TOUCH!!! Only the ref and unref commands should alter ref_cnt.
Definition: plugins.h:239
CommandProcType help_proc
Optional handler to provide extended help beyond the desc field above.
Definition: plugins.h:269
uint32 Flags
IRC letter-based flag system (+o/-x/etc.)
Definition: plugins.h:159
A SHOUTcast v2 (Ultravox protocol) server.
Definition: plugins.h:131
bool online
Is your radio online (depends on setting of PullNameFromAnyServer how it is calculated) ...
Definition: plugins.h:338
Definition: plugins.h:789
Definition: plugins.h:782
Definition: plugins.h:850
Definition: plugins.h:381
uint32 datalen
The length of data following the header (little-endian)
Definition: plugins.h:309
REMOTE_COMMANDS
Definition: remote_protocol.h:39
bool title_changed
Did the title change from the last scrape?
Definition: plugins.h:339
const char * mime_type
Definition: plugins.h:735
Definition: plugins.h:580
Definition: plugins.h:133
unsigned long long uint64
Definition: plugins.h:42
Definition: plugins.h:733
bool Temporary
The user was gotten from a remote source (auth plugin). The user account won't be loaded again the ne...
Definition: plugins.h:160
const char * platform
The platform the bot is running on.
Definition: plugins.h:964
Definition: plugins.h:781
uint32 Votes
The number of votes on this song.
Definition: plugins.h:359
Definition: plugins.h:851
const char * cur_playing
Definition: plugins.h:736
Definition: plugins.h:519
const char * Channel
If presence was caused by something in a channel/group, it will be here, otherwise it will be NULL...
Definition: plugins.h:204
uint32 id
Optional member the source plugin can use however it wants.
Definition: plugins.h:374
USER * 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.
Definition: plugins.h:197
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.
Definition: plugins.h:218
int32 streamid
Definition: plugins.h:327
userPresSendFunc send_chan
Send a message to the channel the user is in (ONLY valid if Channel != NULL)
Definition: plugins.h:215
A SHOUTcast v1 server.
Definition: plugins.h:130
API_ial * ial
Definition: plugins.h:1020
const char * genre
Definition: plugins.h:737
DL_HANDLE hInstance
Definition: plugins.h:954
T_SOCKET * Sock
Data for the USER_PRESENCE provider, a socket.
Definition: plugins.h:209
Definition: plugins.h:134
API_memory * mem
Definition: plugins.h:1027
API_config * config
Definition: plugins.h:1024
API_yp * yp
Definition: plugins.h:1030
int plugin
Plugin number that registered this command, or -1 for an IRCBot internal command. ...
Definition: plugins.h:277
API_textfunc * textfunc
Definition: plugins.h:1021
int(* CommandProcType)(const char *command, const char *parms, USER_PRESENCE *ut, uint32 type)
type is one of the CM_ALLOW_* defines below
Definition: plugins.h:244
Definition: plugins.h:664
const char * desc
A string containing the help text for the command.
Definition: plugins.h:268
API_user * user
Definition: plugins.h:1023
char * plugin_author
The name of the author of this plugin. (Can be a person, company, URL, whatever). ...
Definition: plugins.h:887
Definition: plugins.h:780
signed long long int64
Definition: plugins.h:41
const char int line
Definition: plugins.h:556
uint32 mask
A bitmask of the CM_ALLOW_* defines below, specifies from which contexts a command may be used...
Definition: plugins.h:276
Definition: plugins.h:501
int listeners
Definition: plugins.h:341
Definition: plugins.h:849
Definition: plugins.h:564
An icecast2 server.
Definition: plugins.h:132
userPresSendFunc std_reply
This is for a command reply to simplify code for IRC. If the user said something in the channel to ac...
Definition: plugins.h:214
Definition: plugins.h:745
Definition: plugins.h:852
unsigned int uint32
Definition: plugins.h:44
char * plugin_name_long
The long name of your plugin with version info (if you want).
Definition: plugins.h:886
int32 NumHostmasks
Definition: plugins.h:164
#define MAX_FIND_RESULTS
Definition: plugins.h:365
int maxusers
Definition: plugins.h:343
API_commands * commands
Definition: plugins.h:1022
Definition: plugins.h:418
uint32 proc_type
COMMAND_ACTION or COMMAND_PROC.
Definition: plugins.h:274
API_db * db
Definition: plugins.h:1025
signed char int8
Definition: plugins.h:47
API_irc * irc
Definition: plugins.h:1019
uint32 flags_all
user must have all these flags to be allowed
Definition: plugins.h:254
Definition: plugins.h:196
Definition: plugins.h:337
API_curl * curl
Definition: plugins.h:1026
bool(* EnumUsersByLastHostmaskCallback)(USER *user, void *ptr)
Definition: plugins.h:572
const char * action
The raw IRC command to send (if proc_type == COMMAND_ACTION)
Definition: plugins.h:271
bool have_more
Definition: plugins.h:387
Definition: plugins.h:881
Definition: plugins.h:372
int start
Definition: plugins.h:383
uint32 Flags
The user's flags.
Definition: plugins.h:202
SS_TYPES type
The sound server type.
Definition: plugins.h:328
time_t Seen
When the user was last seen.
Definition: plugins.h:162
#define MAX_HOSTMASKS
Definition: plugins.h:86
userPresSendFunc send_msg
Send a PRIVMSG to the user.
Definition: plugins.h:217
int plugin
Definition: plugins.h:389