summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrostycoolslug <frostycoolslug@e03df62e-2008-0410-955e-edbf42e46eb7>2005-03-15 16:13:24 +0000
committerfrostycoolslug <frostycoolslug@e03df62e-2008-0410-955e-edbf42e46eb7>2005-03-15 16:13:24 +0000
commitbe24cbdaa1173563a625636ee05a8dcaddc24800 (patch)
tree15957ecf16e63961c8b29f3051b8c088daf11da6 /src
parent54d2d16592e7545d45ae4fab2e6563d0f44ca4f8 (diff)
Added Comment with regard to 'hidden command' :D
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@886 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_randquote.cpp46
1 files changed, 29 insertions, 17 deletions
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index d14445d51..197efcdb6 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -21,20 +21,38 @@
#include "channels.h"
#include "modules.h"
+Server *Srv;
+FileReader *quotes;
+
+std::string q_file;
+std::string prefix;
+std::string suffix;
+
+
/* $ModDesc: Provides random Quotes on Connect. */
+void handle_randquote(char** parameters, int pcntl, userrec *user)
+{
+ std::string str;
+ int fsize;
+ char buf[MAXBUF];
+
+ fsize = quotes->FileSize();
+ srand(time(NULL));
+ str = quotes->GetLine(rand() % fsize);
+
+ sprintf(buf,"NOTICE %s :%s%s%s",user->nick,prefix.c_str(),str.c_str(),suffix.c_str());
+ Srv->SendServ(user->fd, buf);
+ return;
+}
+
class ModuleRandQuote : public Module
{
private:
Server *Srv;
ConfigReader *conf;
- FileReader *quotes;
-
- std::string q_file;
- std::string prefix;
- std::string suffix;
public:
ModuleRandQuote()
@@ -59,6 +77,8 @@ class ModuleRandQuote : public Module
printf("m_randquote: QuoteFile not Found!! Please check your config.\n\n");
exit(0);
}
+ /* Hidden Command -- Mode clients assume /quote sends raw data to an IRCd >:D */
+ Srv->AddCommand("QUOTE",handle_randquote,0,0);
}
virtual ~ModuleRandQuote()
@@ -75,17 +95,10 @@ class ModuleRandQuote : public Module
virtual void OnUserConnect(userrec* user)
{
- std::string str;
- int fsize;
- char buf[MAXBUF];
-
- fsize = quotes->FileSize();
- srand(time(NULL));
- str = quotes->GetLine(rand() % fsize);
-
- sprintf(buf,"NOTICE %s :%s%s%s",user->nick,prefix.c_str(),str.c_str(),suffix.c_str());
- Srv->SendServ(user->fd, buf);
- return;
+ // Make a fake pointer to be passed to handle_randquote()
+ // Dont try this at home kiddies :D
+ char *rar = "RAR";
+ handle_randquote(&rar, 0, user);
}
};
@@ -113,4 +126,3 @@ extern "C" void * init_module( void )
{
return new ModuleRandQuoteFactory;
}
-