Page MenuHomeDevCentral

D877.id2237.diff
No OneTemporary

D877.id2237.diff

diff --git a/source/chansrv.c b/source/chansrv.c
--- a/source/chansrv.c
+++ b/source/chansrv.c
@@ -178,20 +178,20 @@
{
struct chanserv_output *result = NULL;
char temp[1024] = { 0 };
- long sn = 0;
+ long level = 0;
if (!args || !args[0] || !args[1] || !args[2] || !args[3])
return result;
- sn = atoi(args[2]);
- if (sn > 10 || sn <= 0)
+ level = atoi(args[2]);
+ if (level > 10 || level <= 0)
return result;
if (strlen(args[1]) < 7)
return result;
snprintf(temp, sizeof (temp), "I haven't used \2%cSETINFO\2 yet!", *CMDCHAR);
- add_helper(args[0], mask_from_nick(args[1], target), sn, 0, temp, args[3], 0);
+ add_helper(args[0], mask_from_nick(args[1], target), level, 0, temp, args[3], 0);
save_changes();
- return chanserv_asprintf(NULL, "Added user: %s - level %d.", mask_from_nick(args[1], target), sn);
+ return chanserv_asprintf(NULL, "Added user: %s - level %d.", mask_from_nick(args[1], target), level);
}
struct chanserv_output *chanserv_alarm(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
@@ -199,7 +199,7 @@
struct chanserv_output *result = NULL;
char temp[1024] = { 0 };
- time_t sn = 0, unixtime = 0;
+ time_t seconds = 0, unixtime = 0;
long i = 0;
if (!args || !args[0] || !args[1] || (strlen(args[0]) < 2))
@@ -208,25 +208,25 @@
if (tolower(*args[0]) == 'd')
{
/* Days. */
- sn = 86400;
+ seconds = 86400;
args[0]++;
}
else if (tolower(*args[0]) == 'h')
{
/* Hours */
- sn = 3600;
+ seconds = 3600;
args[0]++;
}
else if (tolower(*args[0]) == 'm')
{
/* Minutes */
- sn = 60;
+ seconds = 60;
args[0]++;
}
else if (tolower(*args[0]) == 's')
{
/* Seconds */
- sn = 1;
+ seconds = 1;
args[0]++;
}
else
@@ -237,11 +237,11 @@
snprintf(temp, sizeof (temp), "%s/%ld",
DBTIMERS_PATH,
- (atoi (args[0]) * sn) + time (NULL));
+ (atoi (args[0]) * seconds) + time (NULL));
db_log(temp, "PRIVMSG %s :\2ALARMCLOCK\2 by %s!%s: %s", source, source, userhost, args[1]);
- unixtime = atoi (args[0]) * sn;
+ unixtime = atoi (args[0]) * seconds;
if (unixtime > 86400)
result = chanserv_asprintf(NULL, "alarmclock set to go off in %d day%s, %02d:%02d.",
@@ -718,7 +718,7 @@
{
struct chanserv_output *result = NULL;
char server [STRING_LONG] = {0}, str [STRING_LONG] = {0};
- long sn = 0;
+ long port = 0;
if (!args || !args[0])
return result;
@@ -727,15 +727,15 @@
args++;
if ((db_argstostr (str, args, 0, ' ')) < 1)
- sn = 6667;
+ port = 6667;
else
- sn = atoi(str);
+ port = atoi(str);
- S ("QUIT :Jumping to %s:%d\n", server, sn);
+ S ("QUIT :Jumping to %s:%d\n", server, port);
db_sleep (1);
strncpy (BS, server, sizeof (BS));
- BP = sn;
+ BP = port;
prepare_bot ();
register_bot ();
@@ -1209,21 +1209,21 @@
struct chanserv_output *chanserv_repeat(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
{
struct chanserv_output *result = NULL;
- long sn2 = 0, sn = 0;
- char str [STRING_LONG] = {0};
+ long delay = 0, count = 0;
+ char rawdata [STRING_LONG] = {0};
if (!args || !args[0] || !args[1] || !args[2])
return result;
- sn = atoi (args[0]);
- sn2 = atoi (args[1]);
- if ((db_argstostr (str, args, 2, ' ')) < 1)
+ count = atoi (args[0]);
+ delay = atoi (args[1]);
+ if ((db_argstostr (rawdata, args, 2, ' ')) < 1)
return result;
- while (sn > 0)
+ while (count > 0)
{
- S ("%s\n", str);
- db_sleep (sn2);
- sn--;
+ S ("%s\n", rawdata);
+ db_sleep (delay);
+ count--;
}
return result;
@@ -1232,7 +1232,7 @@
struct chanserv_output *chanserv_replace(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
{
struct chanserv_output *result = NULL;
- char topic [STRING_LONG] = {0}, str [STRING_LONG] = {0};
+ char topic [STRING_LONG] = {0}, text [STRING_LONG] = {0};
if (!args || !args[0])
return chanserv_asprintf(NULL, "Replace what?");
@@ -1245,13 +1245,13 @@
args++;
/* Make sure there's information to be replaced. */
- if ((db_argstostr (str, args, 0, ' ')) < 1)
+ if ((db_argstostr (text, args, 0, ' ')) < 1)
return chanserv_asprintf(NULL, "What info should replace %s?",
topic);
/* Don't let str go over MAX_DATA_SIZE characters. */
- if (strlen(str) > MAX_DATA_SIZE)
- str[MAX_DATA_SIZE] = '\0';
+ if (strlen(text) > MAX_DATA_SIZE)
+ text[MAX_DATA_SIZE] = '\0';
strlwr(topic);
@@ -1261,11 +1261,11 @@
/* Replace the data. */
delete_url (source, topic, target);
if (LOG_ADD_DELETES)
- db_log (ADD_DELETES, "[%s] %s!%s REPLACE %s %s\n", date (), source, userhost, topic, str);
+ db_log (ADD_DELETES, "[%s] %s!%s REPLACE %s %s\n", date (), source, userhost, topic, text);
ADDITIONS++;
- db_log (URL2, "%s %s\n", topic, str);
+ db_log (URL2, "%s %s\n", topic, text);
return chanserv_asprintf(NULL, "%s has been updated.", topic);
}
@@ -1295,13 +1295,13 @@
struct chanserv_output *chanserv_restart(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
{
struct chanserv_output *result = NULL;
- char temp[1024] = { 0 };
+ char command[1024] = { 0 };
int ret;
S("QUIT :Restarting %s ...\n", dbVersion);
db_sleep(2);
- snprintf(temp, sizeof (temp), "%s", DARKBOT_BIN);
- ret = system(temp);
+ snprintf(command, sizeof (command), "%s", DARKBOT_BIN);
+ ret = system(command);
db_sleep(1);
exit(0);
@@ -1389,31 +1389,31 @@
struct chanserv_output *chanserv_setinfo(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
{
struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
+ char greeting [STRING_LONG] = {0};
if (!args)
return chanserv_asprintf (NULL, "My %s variables are: ^ nick, %% number of joins, & Channel, $ user@host. Example: !setinfo ^ has joined & %% times (also, if you make the first char of your %s a \"+\", the %s will be shown as an ACTION).", cmd, cmd, cmd);
- if ((db_argstostr (str, args, 0, ' ')) < 1)
+ if ((db_argstostr (greeting, args, 0, ' ')) < 1)
return;
- update_setinfo (userhost, str, source);
+ update_setinfo (userhost, greeting, source);
return (result);
}
struct chanserv_output *chanserv_sleep(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
{
struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
+ char period [STRING_LONG] = {0};
Sleep_Toggle = 1;
/* Copy arguments to buffer, if there is one convert to long
* and use it as the sleep time in seconds. */
- if ((db_argstostr (str, args, 0, '\0')) < 1)
+ if ((db_argstostr (period, args, 0, '\0')) < 1)
Sleep_Time = SLEEP_TIME;
- else if ((Sleep_Time = strtol (str, (char **) NULL, 10)) < 1)
+ else if ((Sleep_Time = strtol (period, (char **) NULL, 10)) < 1)
Sleep_Time = SLEEP_TIME;
strncpy (sleep_chan, target, sizeof (sleep_chan));
@@ -1493,7 +1493,7 @@
struct chanserv_output *chanserv_tell(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
{
struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
+ char topic [STRING_LONG] = {0};
if (!args || !args[0])
return chanserv_asprintf(NULL, "Tell who?");
@@ -1504,26 +1504,26 @@
if (strcasecmp (args[1], "ABOUT") == 0)
{
- if ((db_argstostr (str, args, 2, '+')) < 1)
+ if ((db_argstostr (topic, args, 2, '+')) < 1)
return chanserv_asprintf(NULL, "Tell %s about what?", args[0]);
- strlwr(str);
+ strlwr(topic);
if (invoked == MSG_INVOKE)
- result = show_url (source, get_multiword_topic (str), args[0], 1, 0, userhost, 1);
+ result = show_url (source, get_multiword_topic (topic), args[0], 1, 0, userhost, 1);
else
- result = show_url (args[0], get_multiword_topic (str), target, 1, 0, userhost, 1);
+ result = show_url (args[0], get_multiword_topic (topic), target, 1, 0, userhost, 1);
}
else
{
- if ((db_argstostr (str, args, 1, '+')) < 1)
+ if ((db_argstostr (topic, args, 1, '+')) < 1)
return chanserv_asprintf (NULL, "Tell %s about what?", args[0]);
- strlwr(str);
+ strlwr(topic);
if (invoked == MSG_INVOKE)
- result = show_url (source, get_multiword_topic (str), args[0], 1, 0, userhost, 1);
+ result = show_url (source, get_multiword_topic (topic), args[0], 1, 0, userhost, 1);
else
- result = show_url (args[0], get_multiword_topic (str), target, 1, 0, userhost, 1);
+ result = show_url (args[0], get_multiword_topic (topic), target, 1, 0, userhost, 1);
}
return result;
@@ -1645,10 +1645,10 @@
//#ifndef WIN32
struct chanserv_output *chanserv_uptime(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
{
- char temp[1024] = { 0 };
+ char command[1024] = { 0 };
- snprintf(temp, sizeof (temp), "uptime\n");
- return chanserv_asprintf(NULL, "Uptime: %s.", run_program(temp));
+ snprintf(command, sizeof (command), "uptime\n");
+ return chanserv_asprintf(NULL, "Uptime: %s.", run_program(command));
}
//#endif
@@ -1790,7 +1790,7 @@
struct chanserv_output *chanserv_where(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
{
struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
+ char topic [STRING_LONG] = {0};
char *ptr3 = NULL;
if (!args || !args[0])
@@ -1806,9 +1806,9 @@
memmove (ptr3, ptr3 + 1, strlen (ptr3 + 1) + 1);
if (strcasecmp (args[1], "A") == 0 || strcasecmp (args[1], "AN") == 0)
{
- if ((db_argstostr (str, args, 2, ' ')) < 1)
+ if ((db_argstostr (topic, args, 2, ' ')) < 1)
return chanserv_asprintf(NULL, "%s %s %s? Mind rephrasing that? (Type %cHELP for syntax hints).", cmd, args[0], args[1], *CMDCHAR);
- result = show_url (source, get_multiword_topic (str), (invoked == MSG_INVOKE) ? source : target, 1, 0, userhost, 0);
+ result = show_url (source, get_multiword_topic (topic), (invoked == MSG_INVOKE) ? source : target, 1, 0, userhost, 0);
}
else
result = show_url (source, get_multiword_topic (args[1]), (invoked == MSG_INVOKE) ? source : target, 1, 0, userhost, 0);
@@ -1819,7 +1819,7 @@
struct chanserv_output *chanserv_whisper(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
{
struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
+ char topic [STRING_LONG] = {0};
if (!args || !args[0])
return chanserv_asprintf(NULL, "Whisper to who?");
@@ -1829,10 +1829,10 @@
return result; /* don't bother telling myself about stuff */
if (strcasecmp (args[1], "ABOUT") == 0)
{
- if ((db_argstostr (str, args, 2, ' ')) < 1)
+ if ((db_argstostr (topic, args, 2, ' ')) < 1)
return chanserv_asprintf(NULL, "Whisper to %s about what?", args[0]);
- strlwr(str);
- result = show_url(source, get_multiword_topic(str), args[0], 1, 0, userhost, 1);
+ strlwr(topic);
+ result = show_url(source, get_multiword_topic(topic), args[0], 1, 0, userhost, 1);
}
else
{

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 9, 08:13 (18 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2803656
Default Alt Text
D877.id2237.diff (10 KB)

Event Timeline