Added new userlevel friend
Fixed an ordering problem on the verbose queue
TODO ticket messages
+
+2.17
+Users of level lamer authing after join will be kicked
+Fixed an account expiration issue for users of level lamer
+Added command help for commands ged and text to the svn
+Invite command problems with friend users fixed (original fix by paul)
+Added ticket message support
+Caps kick now understands /me and excludes it from the test
+Some cleancups
+Several fixes related to userlevels, mostly to the new H_FRIEND
+Added new command channel to print all channel users
-Syntax: listuser [pattern]
+Syntax: listuser [level] [pattern]
Example: listuser *
Lists H accounts based on the pattern.
If no pattern is specified, all accounts are listed.
+If level is specified then the search is performed only on the users of the given level. Level is an integer from 0 (lamer) to 6 (administrator)
-Syntax: ticket channel [nick1] [expiration]
+Syntax: ticket channel [nick1] [expiration] [message]
Example: ticket #feds user
Gives the user an invite ticket for the channel.
With the ticket, the user can use the invite command to get to the channel.
Ticket expiration time is optional.
+Message is optional but must be defined as a string with a custom expiration time.
{
hchannel_user *tmp;
for (tmp = hchan->channel_users;tmp;tmp = tmp->next)
- if (huser_get_level(tmp->husr) > H_PEON)
+ if (huser_get_level(tmp->husr) >= H_TRIAL)
{
huser_channel *huserchan = huser_on_channel(tmp->husr, hchan);
if ((time(NULL) - huserchan->last_activity < HELPMOD_QUEUE_TIMEOUT) && (huserchan->last_activity != tmp->time_joined))
helpmod_reply(sender, returntype, "No term found matching '%s'", argv[0]);
return;
}
- if (returntype != NULL && huser_get_level(sender) > H_PEON)
+ if (returntype != NULL && huser_get_level(sender) >= H_TRIAL)
{
HCHANNEL_VERIFY_AUTHORITY(hchan, sender);
helpmod_reply(sender, returntype, "No term found matching '%s'", argv[1]);
return;
}
- if (returntype != NULL && huser_get_level(sender) > H_PEON)
+ if (returntype != NULL && huser_get_level(sender) >= H_TRIAL)
helpmod_message_channel(hchannel_get_by_channel(returntype), "(%s): %s", htrm->name->content, htrm->description->content);
else
helpmod_reply(sender, returntype, "(%s): %s", htrm->name->content, htrm->description->content);
return;
}
- if (huser_get_level(sender) == H_PEON || huser_get_level(sender) == H_FRIEND)
+ if (huser_get_level(sender) < H_STAFF)
{
hticket *htick;
hchan = hchannel_get_by_name(argv[0]);
hchannel *hchan;
huser *husr;
hticket *htick;
+ const char *message = NULL;
if (argc < 1)
{
helpmod_reply(sender, returntype, "Cannot issue a ticket: User %s does not require a ticket", argv[1]);
return;
}
- if (argc >= 3)
+ if (argc > 3)
{
- int tmp;
+ int tmp;
tmp = helpmod_read_strtime(argv[2]);
if (tmp > HDEF_m && tmp < 2 * HDEF_M)
- expiration = tmp;
+ expiration = tmp;
+ }
+ if (argc >= 4 && strlen(argv[3]) < 128)
+ {
+ if (argv[3][0] != '\0')
+ message = argv[3];
}
htick = hticket_get(huser_get_auth(husr), hchan);
if (htick != NULL)
htick->time_expiration = time(NULL) + expiration;
else
- hticket_add(huser_get_auth(husr), time(NULL) + expiration, hchan);
+ hticket_add(huser_get_auth(husr), time(NULL) + expiration, hchan, message);
helpmod_reply(sender, returntype, "Issued an invite ticket to user %s for channel %s expiring in %s", huser_get_nick(husr), hchannel_get_name(hchan), helpmod_strtime(expiration));
helpmod_reply(husr, NULL, "You have been issued an invite ticket for channel %s. This ticket is valid for a period of %s. You can use my invite command to get to the channel now. Type /msg %s invite %s",hchannel_get_name(hchan), helpmod_strtime(HTICKET_EXPIRATION_TIME), helpmodnick->nick, hchannel_get_name(hchan));
int i;
DEFINE_HCHANNEL;
-/*
- HCHANNEL_VERIFY_AUTHORITY(hchan, sender);
-*/
+
if (argc > H_CMD_MAX_ARGS)
argc = H_CMD_MAX_ARGS;
{
helpmod_reply(sender, returntype, "Cannot show the ticket: User %s does not have a valid ticket for channel %s", argv[i], hchannel_get_name(hchan));
continue;
- }
- helpmod_reply(sender, returntype, "User %s has a ticket for channel %s expiring in %s", argv[i], hchannel_get_name(hchan), helpmod_strtime(htick->time_expiration - time(NULL)));
+ }
+ if (htick->message == NULL)
+ helpmod_reply(sender, returntype, "User %s has a ticket for channel %s expiring in %s. No message is attached.", argv[i], hchannel_get_name(hchan), helpmod_strtime(htick->time_expiration - time(NULL)));
+ else
+ helpmod_reply(sender, returntype, "User %s has a ticket for channel %s expiring in %s. With message: %s", argv[i], hchannel_get_name(hchan), helpmod_strtime(htick->time_expiration - time(NULL)), htick->message->content);
}
}
{
if (!fgets(buffer, 512, in))
break;
- if (returntype != NULL && huser_get_level(sender) > H_PEON)
+ if (returntype != NULL && huser_get_level(sender) >= H_TRIAL)
helpmod_message_channel(hchannel_get_by_channel(returntype), "%s", buffer);
else
helpmod_reply(sender, returntype, "%s", buffer);
helpmod_reply(sender, returntype, "Evilhack2 done: Swapped %d and %d", first, second);
}
+static void helpmod_cmd_channel (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
+{
+ hchannel *hchan;
+ hchannel_user *hchanuser;
+
+ DEFINE_HCHANNEL;
+
+ if (hchan == NULL)
+ {
+ helpmod_reply(sender, returntype, "Can not show channel: Channel not specified");
+ return;
+ }
+
+ HCHANNEL_VERIFY_AUTHORITY(hchan, sender);
+
+ helpmod_reply(sender, returntype, "Users for channel %s", hchannel_get_name(hchan));
+ helpmod_reply(sender, returntype, "Nick Account User level Idle time");
+
+ for (hchanuser = hchan->channel_users;hchanuser;hchanuser=hchanuser->next)
+ helpmod_reply(sender, returntype, "%-16s %-16s %-24s %s",hchanuser->husr->real_user->nick,hchanuser->husr->account?hchanuser->husr->account->name->content:"-",hlevel_name(huser_get_level(hchanuser->husr)), helpmod_strtime(time(NULL)-huser_on_channel(hchanuser->husr, hchan)->last_activity));
+
+ helpmod_reply(sender, returntype, "Listed %d users for channel %s", hchannel_count_users(hchan, H_ANY), hchannel_get_name(hchan));
+}
+
/* old H stuff */
void helpmod_cmd_load (huser *sender, channel *returntype, char* arg, int argc, char *argv[])
{
hcommand_add("friend", H_STAFF, helpmod_cmd_friend, "Sets the userlevel of the target to friend (lvl 2)");
hcommand_add("trial", H_OPER, helpmod_cmd_trial, "Sets the userlevel of the target to trial staff (lvl 3)");
hcommand_add("staff", H_OPER, helpmod_cmd_staff, "Sets the userlevel of the target to staff (lvl 4)");
+
hcommand_add("oper", H_OPER, helpmod_cmd_oper, "Sets the userlevel of the target to oper (lvl 5)");
hcommand_add("admin", H_ADMIN, helpmod_cmd_admin, "Sets the userlevel of the target to admin (lvl 6)");
hcommand_add("deluser", H_OPER, helpmod_cmd_deluser, "Removes an account from " HELPMOD_NICK);
hcommand_add("rating", H_TRIAL, helpmod_cmd_rating, "Simple rating for the current week");
hcommand_add("writedb", H_OPER, helpmod_cmd_writedb, "Writes the " HELPMOD_NICK " database to disk");
+ hcommand_add("channel", H_TRIAL, helpmod_cmd_channel, "Gives a list of all channel users");
/*hcommand_add("megod", H_PEON, helpmod_cmd_megod, "Gives you userlevel 4, if you see this in the final version, please kill strutsi");*/
/*hcommand_add("test", H_PEON, helpmod_cmd_test, "Gives you userlevel 4, if you see this in the final version, please kill strutsi");*/
}
return -1;
if (tmp > time(NULL))
- hticket_add(buf3, tmp, hchannel_get_by_name(buf2));
+ {
+ if (hconf_version < HELPMOD_VERSION_2_17)
+ hticket_add(buf3, tmp, hchannel_get_by_name(buf2), NULL);
+ else
+ {
+ fgets(ptr = buf, 256, in);
+ if (feof(in))
+ return -1;
+ helpmod_line_fix(&ptr);
+
+ if (*ptr == '\0')
+ hticket_add(buf3, tmp, hchannel_get_by_name(buf2), NULL);
+ else
+ hticket_add(buf3, tmp, hchannel_get_by_name(buf2), ptr);
+ }
+ }
return 0;
}
fprintf(out, "\t%s\n", hchannel_get_name(hchan));
fprintf(out, "\t%s\n", htick->authname);
fprintf(out, "\t%u\n", (unsigned int)htick->time_expiration);
+ if (htick->message)
+ fprintf(out, "\t%s\n", htick->message->content);
+ else
+ fprintf(out, "\n");
return 0;
}
/* configuration */
/* These should always be equal */
-#define HELPMOD_VERSION_INTERNAL HELPMOD_VERSION_2_16
-#define HELPMOD_VERSION "2.16"
+#define HELPMOD_VERSION_INTERNAL HELPMOD_VERSION_2_17
+#define HELPMOD_VERSION "2.17"
#define HELPMOD_USER_TIMEOUT 1200
return;
}
- if (huser_get_level(husr) > H_PEON && (huser_get_account_flags(husr) & H_AUTO_OP) && hchannel_authority(hchan, husr))
+ if (huser_get_level(husr) >= H_STAFF && (huser_get_account_flags(husr) & H_AUTO_OP) && hchannel_authority(hchan, husr))
helpmod_channick_modes(husr, hchan ,MC_OP,HNOW);
- if (huser_get_level(husr) > H_PEON && (huser_get_account_flags(husr) & H_AUTO_VOICE) && hchannel_authority(hchan, husr))
+ if (huser_get_level(husr) >= H_TRIAL && (huser_get_account_flags(husr) & H_AUTO_VOICE) && hchannel_authority(hchan, husr))
helpmod_channick_modes(husr, hchan, MC_VOICE,HNOW);
if (hchan->flags & H_WELCOME && *hchan->real_channel->index->name->content)
if (hchan->flags & H_PASSIVE)
return;
- if (huser_get_level(husr) == H_LAMER || (huser_get_level(husr) == H_PEON && hban_check(nck)))
+ huser_activity(husr, NULL);
+
+ if (huser_get_level(husr) == H_LAMER || (huser_get_level(husr) <= H_TRIAL && hban_check(nck)))
{
hban *hb = hban_check(nck);
assert(huserchan != NULL);
huserchan->flags &= ~HCUMODE_OP;
-
}
static void helpmod_hook_channel_voiced(int unused, void *args)
if (husr == NULL)
return;
else
- husr->account = haccount_get_by_name(nck->authname);
+ husr->account = haccount_get_by_name(nck->authname);
+
+ if (huser_get_level(husr) == H_LAMER)
+ while (husr->hchannels)
+ helpmod_kick(husr->hchannels->hchan, husr, "Your presence on channel %s is not wanted", hchannel_get_name(husr->hchannels->hchan));
}
static void helpmod_hook_server_newserver(int unused, void *args)
{
const char *banmask = hban_ban_string(husr->real_user, HBAN_HOST);
char reason_buffer[128];
- /*
- switch (violation)
- {
- case HLC_CAPS:
- hban_add(banmask, "Excessive use of capital letters", time(NULL) + HLC_DEFAULT_BANTIME, 0);
- break;
- case HLC_REPEAT:
- hban_add(banmask, "Excessive repeating", time(NULL) + HLC_DEFAULT_BANTIME, 0);
- break;
- case HLC_CHARACTER_REPEAT:
- hban_add(banmask, "Excessive improper use of language", time(NULL) + HLC_DEFAULT_BANTIME, 0);
- break;
- case HLC_FLOOD:
- hban_add(banmask, "Excessive flooding", time(NULL) + HLC_DEFAULT_BANTIME, 0);
- break;
- case HLC_SPAM:
- hban_add(banmask, "Excessive spamming", time(NULL) + HLC_DEFAULT_BANTIME, 0);
- break;
- }
- */
- sprintf(reason_buffer, "Excessive violations: %s", hlc_get_violation_name(violation));
+ sprintf(reason_buffer, "Excessive violations: %s", hlc_get_violation_name(violation));
hban_add(banmask, reason_buffer, time(NULL) + HLC_DEFAULT_BANTIME, 0);
if (IsAccount(husr->real_user))
}
if (husr->lc[violation] >= hchan->lc_profile->tolerance_kick) /* get rid of the thing */
{
- /* switch (violation)
- {
- case HLC_CAPS:
- helpmod_kick(hchan, husr, "Channel rule violation: Excessive use of capital letters");
- break;
- case HLC_REPEAT:
- helpmod_kick(hchan, husr, "Channel rule violation: Repeating");
- break;
- case HLC_CHARACTER_REPEAT:
- helpmod_kick(hchan, husr, "Channel rule violation: Improper use of language");
- break;
- case HLC_FLOOD:
- helpmod_kick(hchan, husr, "Channel rule violation: Flooding");
- break;
- case HLC_SPAM:
- helpmod_kick(hchan, husr, "Channel rule violation: Spamming");
- break;
- }
- */
helpmod_kick(hchan, husr, "Channel rule violation: %s", hlc_get_violation_name(violation));
return !0;
}
if (husr->lc[violation] >= hchan->lc_profile->tolerance_warn) /* get rid of the thing */
{
-/* switch (violation)
- {
- case HLC_CAPS:
- helpmod_reply(husr, NULL, "You are violating the channel rule of %s : Excessive use of capital letters", hchannel_get_name(hchan));
- break;
- case HLC_REPEAT:
- helpmod_reply(husr, NULL, "You are violating the channel rule of %s : Repeating", hchannel_get_name(hchan));
- break;
- case HLC_CHARACTER_REPEAT:
- helpmod_reply(husr, NULL, "You are violating the channel rule of %s : Improper use of language", hchannel_get_name(hchan));
- break;
- case HLC_FLOOD:
- helpmod_reply(husr, NULL, "You are violating the channel rule of %s : Flooding", hchannel_get_name(hchan));
- break;
- case HLC_SPAM:
- helpmod_reply(husr, NULL, "You are violating the channel rule of %s : Spamming", hchannel_get_name(hchan));
- break;
- }
- */
- helpmod_reply(husr, NULL, "You are violating the channel rule of %s : %s. Continuos violation of this rule will result in you being removed from %s", hchannel_get_name(hchan), hlc_get_violation_name(violation), hchannel_get_name(hchan));
+ helpmod_reply(husr, NULL, "You are violating the channel rule of %s : %s. Continuous violation of this rule will result in you being removed from %s", hchannel_get_name(hchan), hlc_get_violation_name(violation), hchannel_get_name(hchan));
}
return 0;
int noncaps = 0;
int i;
+ /* Handle the thing sent with /me */
+ if (!strncmp(line, "\0x01ACTION", 6 + 1))
+ line+=(6 + 1);
+
for (i = 0;line[i];i++)
{
if (isalpha(line[i]))
if (huser_get_level(hchanuser->husr) == H_PEON && huserchan->flags & HCUMODE_VOICE)
helpmod_channick_modes(hchanuser->husr, hchan, MC_DEVOICE, HLAZY);
}
-
}
}
for (ptr = &hchan->htickets;*ptr;ptr = &(*ptr)->next)
if (*ptr == htick)
{
- hticket *tmp = (*ptr)->next;
+ hticket *tmp = (*ptr)->next;
+ if ((*ptr)->message)
+ freesstring((*ptr)->message);
free(*ptr);
*ptr = tmp;
return NULL;
return htick;
}
-hticket *hticket_add(const char *authname, time_t expiration, struct hchannel_struct *hchan)
+hticket *hticket_add(const char *authname, time_t expiration, struct hchannel_struct *hchan, const char *message)
{
hticket *tmp = hticket_get(authname, hchan), **ptr;
strcpy(tmp->authname, authname);
tmp->time_expiration = expiration;
+ if (message == NULL)
+ tmp->message = NULL;
+ else
+ tmp->message = getsstring(message, strlen(message));
+
/* find the correct position */
for (ptr = &hchan->htickets;*ptr && (*ptr)->time_expiration >= expiration;ptr = &(*ptr)->next);
#include <time.h>
-#include "hdef.h"
#include "../irc/irc_config.h"
#include "../nick/nick.h"
+#include "../lib/sstring.h"
+
+#include "hdef.h"
#define HTICKET_EXPIRATION_TIME (2 * HDEF_d)
{
char authname[ACCOUNTLEN +1];
time_t time_expiration;
+ sstring *message;
struct hticket_struct *next;
} hticket;
hticket *hticket_get(const char *, struct hchannel_struct*);
hticket *hticket_del(hticket *, struct hchannel_struct*);
-hticket *hticket_add(const char *, time_t expiration, struct hchannel_struct*);
+hticket *hticket_add(const char *, time_t expiration, struct hchannel_struct*, const char *);
int hticket_count(void);
void hticket_remove_expired(void);
#define HELPMOD_VERSION_2_16 16 /* January 2006*/
+#define HELPMOD_VERSION_2_17 17 /* Late January 2006*/
+
#endif