]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/extra/m_sqlutils.h
cdde51f6771e174992b8b205e577b460809c7b0a
[user/henk/code/inspircd.git] / src / modules / extra / m_sqlutils.h
1 /*       +------------------------------------+\r *       | Inspire Internet Relay Chat Daemon |\r *       +------------------------------------+\r *\r *  InspIRCd: (C) 2002-2007 InspIRCd Development Team\r * See: http://www.inspircd.org/wiki/index.php/Credits\r *\r * This program is free but copyrighted software; see\r *            the file COPYING for details.\r *\r * ---------------------------------------------------\r */\r\r#ifndef INSPIRCD_SQLUTILS\r#define INSPIRCD_SQLUTILS\r\r#include "modules.h"\r\r#define SQLUTILAU "SQLutil AssociateUser"\r#define SQLUTILAC "SQLutil AssociateChan"\r#define SQLUTILUA "SQLutil UnAssociate"\r#define SQLUTILGU "SQLutil GetAssocUser"\r#define SQLUTILGC "SQLutil GetAssocChan"\r#define SQLUTILSUCCESS "You shouldn't be reading this (success)"\r\r/** Used to associate an SQL query with a user\r */\rclass AssociateUser : public Request\r{\rpublic:\r       /** Query ID\r    */\r    unsigned long id;\r      /** User\r        */\r    userrec* user;\r \r       AssociateUser(Module* s, Module* d, unsigned long i, userrec* u)\r       : Request(s, d, SQLUTILAU), id(i), user(u)\r     {\r      }\r      \r       AssociateUser& S()\r     {\r              Send();\r                return *this;\r  }\r};\r\r/** Used to associate an SQL query with a channel\r */\rclass AssociateChan : public Request\r{\rpublic:\r     /** Query ID\r    */\r    unsigned long id;\r      /** Channel\r     */\r    chanrec* chan;\r \r       AssociateChan(Module* s, Module* d, unsigned long i, chanrec* u)\r       : Request(s, d, SQLUTILAC), id(i), chan(u)\r     {\r      }\r      \r       AssociateChan& S()\r     {\r              Send();\r                return *this;\r  }\r};\r\r/** Unassociate a user or  class from an SQL query\r */\rclass UnAssociate : public Request\r{\rpublic:\r      /** The query ID\r        */\r    unsigned long id;\r\r     UnAssociate(Module* s, Module* d, unsigned long i)\r     : Request(s, d, SQLUTILUA), id(i)\r      {\r      }\r      \r       UnAssociate& S()\r       {\r              Send();\r                return *this;\r  }\r};\r\r/** Get the user associated with an SQL query ID\r */\rclass GetAssocUser : public Request\r{\rpublic:\r       /** The query id\r        */\r    unsigned long id;\r      /** The user\r    */\r    userrec* user;\r\r        GetAssocUser(Module* s, Module* d, unsigned long i)\r    : Request(s, d, SQLUTILGU), id(i), user(NULL)\r  {\r      }\r      \r       GetAssocUser& S()\r      {\r              Send();\r                return *this;\r  }\r};\r\r/** Get the channel associated with an SQL query ID\r */\rclass GetAssocChan : public Request\r{\rpublic:\r    /** The query id\r        */\r    unsigned long id;\r      /** The channel\r         */\r    chanrec* chan;\r\r        GetAssocChan(Module* s, Module* d, unsigned long i)\r    : Request(s, d, SQLUTILGC), id(i), chan(NULL)\r  {\r      }\r      \r       GetAssocChan& S()\r      {\r              Send();\r                return *this;\r  }\r};\r\r#endif\r