Author: DNB
Date: Mon Mar 28 17:08:04 2005
New Revision: 65
Modified:
branches/3.0/ChangeLog
branches/3.0/TriviaChan.c
branches/3.0/TriviaCmds.c
branches/3.0/TriviaServ.c
branches/3.0/TriviaServ.h
branches/3.0/TriviaServ_help.c
Log:
add OPCHAN command, for channel ops to set if Trivia gets Channel Ops or not
Modified: branches/3.0/ChangeLog
==============================================================================
--- branches/3.0/ChangeLog (original)
+++ branches/3.0/ChangeLog Mon Mar 28 17:08:04 2005
@@ -0,0 +1,6 @@
+YahtzeeServ Module for NeoStats Changelog.
+Fish (F), Mark (M), DeadNotBuried (D)
+==============================================================================
+3.0.a3-dev
+ - add OPCHAN command for channel ops to set if Trivia gets Channel Op
+ status on joining or not (D)
Modified: branches/3.0/TriviaChan.c
==============================================================================
--- branches/3.0/TriviaChan.c (original)
+++ branches/3.0/TriviaChan.c Mon Mar 28 17:08:04 2005
@@ -67,6 +67,7 @@
/* XXX */
tc->scorepoints = TriviaServ.defaultpoints;
tc->questtime = 60;
+ tc->opchan = 1;
SetChannelModValue (c, tc);
tc->qfl = list_create(-1);
hnode_create_insert (tch, tc, tc->name);
@@ -114,7 +115,11 @@
tc = hnode_get(tcn);
tc->c = c;
SetChannelModValue (c, tc);
- irc_join (tvs_bot, tc->name, "+o");
+ if (tc->opchan) {
+ irc_join (tvs_bot, tc->name, "+o");
+ } else {
+ irc_join (tvs_bot, tc->name, NULL);
+ }
return tc;
}
return NULL;
Modified: branches/3.0/TriviaCmds.c
==============================================================================
--- branches/3.0/TriviaCmds.c (original)
+++ branches/3.0/TriviaCmds.c Mon Mar 28 17:08:04 2005
@@ -232,6 +232,47 @@
}
/*
+ * Allows Chanops to set if Bot sets Op on joining Channel or not
+*/
+int tvs_cmd_opchan (CmdParams* cmdparams)
+{
+ TriviaChan *tc;
+
+ /* check command was from a channel. */
+ if (!cmdparams->channel) {
+ irc_prefmsg (tvs_bot, cmdparams->source, "OPCHAN Command is used in Channel Only");
+ return NS_FAILURE;
+ }
+ /* find if its our channel. */
+ tc = (TriviaChan *)GetChannelModValue (cmdparams->channel);
+ if (!tc) {
+ return NS_FAILURE;
+ }
+ /* finally, these ones are restricted always */
+ if (!IsChanOp(cmdparams->channel->name, cmdparams->source->name)) {
+ /* nope, get lost */
+ return NS_FAILURE;
+ }
+ if (!ircstrcasecmp(cmdparams->av[0], "ON")) {
+ tc->opchan = 1;
+ } else if (!ircstrcasecmp(cmdparams->av[0], "OFF")) {
+ tc->opchan = 0;
+ } else {
+ irc_prefmsg (tvs_bot, cmdparams->source, "OPCHAN can be set to ON or OFF only");
+ return NS_FAILURE;
+ }
+ SaveTChan(tc);
+ /* check if setting changes and op/deop botfinally, these ones are restricted always */
+ if (tc->opchan && !IsChanOp(cmdparams->channel->name, tvs_bot->u->name)) {
+ irc_chanusermode( tvs_bot, cmdparams->channel->name, "+o", tvs_bot->u->name);
+ } else if (!tc->opchan && IsChanOp(cmdparams->channel->name, tvs_bot->u->name)) {
+ irc_chanusermode( tvs_bot, cmdparams->channel->name, "-o", tvs_bot->u->name);
+ }
+ irc_prefmsg (tvs_bot, cmdparams->source, "OPCHAN for %s set to %s", tc->name , tc->opchan ? "On" : "Off");
+ return NS_SUCCESS;
+}
+
+/*
* Lists all Question Sets / Categories available on the network
*/
int tvs_catlist(CmdParams* cmdparams) {
@@ -285,7 +326,11 @@
SaveTChan(tc);
irc_prefmsg (tvs_bot, cmdparams->source, "Added %s with public control set to %s", tc->name, tc->publiccontrol ? "On" : "Off");
CommandReport(tvs_bot, "%s added %s with public control set to %s", cmdparams->source->name, tc->name, tc->publiccontrol ? "On" : "Off");
- irc_join (tvs_bot, tc->name, "+o");
+ if (tc->opchan) {
+ irc_join (tvs_bot, tc->name, "+o");
+ } else {
+ irc_join (tvs_bot, tc->name, NULL);
+ }
} else if (!ircstrcasecmp(cmdparams->av[0], "DEL")) {
if (cmdparams->ac < 2) {
return NS_ERR_SYNTAX_ERROR;
@@ -305,7 +350,7 @@
while ((hnode = hash_scan_next(&hs)) != NULL) {
tc = hnode_get(hnode);
i++;
- irc_prefmsg (tvs_bot, cmdparams->source, "\2%d\2) %s (%s) - Public? %s - Points %d", i, tc->name, (TriviaChan *)GetChannelModValue (tc->c) ? "Open" : "Closed", tc->publiccontrol ? "Yes" : "No", tc->scorepoints);
+ irc_prefmsg (tvs_bot, cmdparams->source, "\2%d\2) %s (%s) - Public? %s - OpChan? %s - Points %d", i, tc->name, (TriviaChan *)GetChannelModValue (tc->c) ? "Open" : "Closed", tc->publiccontrol ? "Yes" : "No", tc->opchan ? "Yes" : "No", tc->scorepoints);
}
irc_prefmsg (tvs_bot, cmdparams->source, "End of list.");
} else {
Modified: branches/3.0/TriviaServ.c
==============================================================================
--- branches/3.0/TriviaServ.c (original)
+++ branches/3.0/TriviaServ.c Mon Mar 28 17:08:04 2005
@@ -85,6 +85,7 @@
{"QS", tvs_cmd_qs, 1, 0, tvs_help_qs, tvs_help_qs_oneline},
{"SETPOINTS", tvs_cmd_sp, 1, 0, tvs_help_sp, tvs_help_sp_oneline},
{"PUBLIC", tvs_cmd_pc, 1, 0, tvs_help_pc, tvs_help_pc_oneline},
+ {"OPCHAN", tvs_cmd_opchan, 1, 0, tvs_help_opchan, tvs_help_opchan_oneline},
{NULL, NULL, 0, 0, NULL, NULL}
};
Modified: branches/3.0/TriviaServ.h
==============================================================================
--- branches/3.0/TriviaServ.h (original)
+++ branches/3.0/TriviaServ.h Mon Mar 28 17:08:04 2005
@@ -74,6 +74,7 @@
int scorepoints;
time_t lastquest;
long questtime;
+ int opchan;
Questions *curquest;
list_t *qfl;
}TriviaChan;
@@ -107,6 +108,8 @@
extern const char tvs_help_sp_oneline[];
extern const char *tvs_help_pc[];
extern const char tvs_help_pc_oneline[];
+extern const char *tvs_help_opchan[];
+extern const char tvs_help_opchan_oneline[];
/* TriviaUser.c */
void tvs_addpoints(Client *u, TriviaChan *tc);
@@ -121,6 +124,7 @@
int tvs_cmd_qs (CmdParams* cmdparams);
int tvs_cmd_sp (CmdParams* cmdparams);
int tvs_cmd_pc (CmdParams* cmdparams);
+int tvs_cmd_opchan (CmdParams* cmdparams);
int tvs_catlist(CmdParams* cmdparams);
int tvs_chans(CmdParams* cmdparams);
Modified: branches/3.0/TriviaServ_help.c
==============================================================================
--- branches/3.0/TriviaServ_help.c (original)
+++ branches/3.0/TriviaServ_help.c Mon Mar 28 17:08:04 2005
@@ -118,3 +118,14 @@
NULL
};
const char tvs_help_pc_oneline[] = "Set public control";
+
+const char *tvs_help_opchan[] = {
+ "Syntax: (in Channel only)",
+ " \2!OPCHAN <ON/OFF>\2",
+ "",
+ "This command Sets the Channel Op status of the Pseudo Client",
+ "If ON it will gain CHANOP status on joining the Channel.",
+ "If OFF it will sit as a normal user in the Channel.",
+ NULL
+};
+const char tvs_help_opchan_oneline[] = "Set CHANOP level";
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.