aboutsummaryrefslogtreecommitdiffstats
path: root/root_commands.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-08-04 21:48:47 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-08-04 21:48:47 +0100
commit65a4a649a6798f7e922b0a32de690260c83e0451 (patch)
treef127fd7b8470d81f4856867c941eee33ec7a23b0 /root_commands.c
parent23d61653fc9404361b8502a6df521746a2f47d29 (diff)
To address bugs #77 and #661, add some code that should avoid triggering
infinite loops between keyboard and chair.
Diffstat (limited to 'root_commands.c')
-rw-r--r--root_commands.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/root_commands.c b/root_commands.c
index fe445d26..6bd953fc 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -916,6 +916,35 @@ static void cmd_yesno( irc_t *irc, char **cmd )
if( irc->queries == NULL )
{
+ /* Alright, alright, let's add a tiny easter egg here. */
+ static irc_t *last_irc = NULL;
+ static time_t last_time = 0;
+ static int times = 0;
+ static const char *msg[] = {
+ "Oh yeah, that's right.",
+ "Alright, alright. Now go back to work.",
+ "Buuuuuuuuuuuuuuuurp... Excuse me!",
+ "Yes?",
+ "No?",
+ };
+
+ if( last_irc == irc && time( NULL ) - last_time < 15 )
+ {
+ if( ( ++times >= 3 ) )
+ {
+ irc_usermsg( irc, "%s", msg[rand()%(sizeof(msg)/sizeof(char*))] );
+ last_irc = NULL;
+ times = 0;
+ return;
+ }
+ }
+ else
+ {
+ last_time = time( NULL );
+ last_irc = irc;
+ times = 0;
+ }
+
irc_usermsg( irc, "Did I ask you something?" );
return;
}