store away message in user struct
This commit is contained in:
parent
795e61089e
commit
befe9b7ed0
6 changed files with 56 additions and 7 deletions
9
Ircu.c
9
Ircu.c
|
@ -112,11 +112,14 @@ UserModes user_umodes[] = {
|
|||
{UMODE_OPER, 'o', NS_ULEVEL_ADMIN},
|
||||
{UMODE_LOCOP, 'O', NS_ULEVEL_OPER},
|
||||
{UMODE_INVISIBLE, 'i', 0},
|
||||
{UMODE_WALLOP, 'w', 0},
|
||||
{UMODE_WALLOP, 'w', 0},
|
||||
{UMODE_SERVNOTICE, 's', 0},
|
||||
{UMODE_DEAF, 'd', 0},
|
||||
{UMODE_CHSERV, 'k', 0},
|
||||
{UMODE_HELPER, 'h', 0},
|
||||
{UMODE_CHSERV, 'k', 0},
|
||||
{UMODE_ACCOUNT, 'r', 0},
|
||||
{UMODE_HIDDENHOST, 'x', 0},
|
||||
/* Afternet extension */
|
||||
{UMODE_HELPER, 'h', 0},
|
||||
};
|
||||
|
||||
const int ircd_cmdcount = ((sizeof (cmd_list) / sizeof (cmd_list[0])));
|
||||
|
|
2
Ircu.h
2
Ircu.h
|
@ -230,6 +230,8 @@
|
|||
#define UMODE_CHSERV 0x0040 /* Unkickable/-o able */
|
||||
#define UMODE_DEBUG 0x0080 /* See hack notices */
|
||||
#define UMODE_HELPER 0x0100 /* Afternets +h cs override mode */
|
||||
#define UMODE_ACCOUNT 0x1100 /* */
|
||||
#define UMODE_HIDDENHOST 0x2100 /* */
|
||||
|
||||
/* Cmodes */
|
||||
#define CMODE_CHANOP 0x0001
|
||||
|
|
43
bans.c
43
bans.c
|
@ -21,11 +21,25 @@
|
|||
** $Id$
|
||||
*/
|
||||
|
||||
#include "stats.h"
|
||||
#include "log.h"
|
||||
|
||||
static hash_t *banshash;
|
||||
|
||||
void
|
||||
AddBan()
|
||||
AddBan(const char* type, const char* user, const char* host, const char* mask,
|
||||
const char* reason, const char* setby, const char* tsset, const char* tsexpires)
|
||||
{
|
||||
Ban* ban;
|
||||
ban.type = type;
|
||||
strlcpy(ban.user, user, MAXUSER];
|
||||
strlcpy(ban.host, host, MAXHOST];
|
||||
strlcpy(ban.mask, mask, MAXHOST];
|
||||
strlcpy(ban.reason, reason,,BUFSIZE];
|
||||
strlcpy(ban.setby ,setby, MAXHOST];
|
||||
ban.tsset;
|
||||
ban.tsexpires;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -33,3 +47,30 @@ DelBan()
|
|||
{
|
||||
}
|
||||
|
||||
int
|
||||
InitBans (void)
|
||||
{
|
||||
banshash = hash_create (-1, 0, 0);
|
||||
if (!banshash) {
|
||||
nlog (LOG_CRITICAL, LOG_CORE, "Create bans hash failed\n");
|
||||
return NS_FAILURE;
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
void
|
||||
FreeBans ()
|
||||
{
|
||||
Ban *ban;
|
||||
hnode_t *bansnode;
|
||||
hscan_t hs;
|
||||
|
||||
hash_scan_begin(&hs, banshash);
|
||||
while ((bansnode = hash_scan_next(&hs)) != NULL ) {
|
||||
ban = hnode_get (bansnode);
|
||||
hash_delete (banshash, bansnode);
|
||||
hnode_destroy (bansnode);
|
||||
free (ban);
|
||||
}
|
||||
hash_destroy(banshash);
|
||||
}
|
||||
|
|
2
bans.h
2
bans.h
|
@ -24,5 +24,7 @@
|
|||
#ifndef _BANS_H_
|
||||
#define _BANS_H_
|
||||
|
||||
int InitBans (void);
|
||||
void FreeBans (void);
|
||||
|
||||
#endif /* _BANS_H_ */
|
||||
|
|
6
main.c
6
main.c
|
@ -178,6 +178,8 @@ main (int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
if(init_chan_hash () != NS_SUCCESS)
|
||||
return EXIT_FAILURE;
|
||||
if(InitBans () != NS_SUCCESS)
|
||||
return EXIT_FAILURE;
|
||||
/* initilize out transfer subsystem */
|
||||
if (init_curl () != NS_SUCCESS)
|
||||
return EXIT_FAILURE;
|
||||
|
@ -582,6 +584,7 @@ do_exit (NS_EXIT_TYPE exitcode, char* quitmsg)
|
|||
/* now free up the users and servers memory */
|
||||
FreeUsers();
|
||||
FreeServers();
|
||||
FreeBans();
|
||||
fini_adns();
|
||||
finiModuleHash();
|
||||
}
|
||||
|
@ -590,9 +593,6 @@ do_exit (NS_EXIT_TYPE exitcode, char* quitmsg)
|
|||
kp_exit();
|
||||
fini_logs ();
|
||||
|
||||
|
||||
|
||||
|
||||
if ((exitcode == NS_EXIT_RECONNECT && me.r_time > 0) || exitcode == NS_EXIT_RELOAD) {
|
||||
execve ("./neostats", NULL, NULL);
|
||||
return_code=EXIT_FAILURE; /* exit code to error */
|
||||
|
|
1
users.c
1
users.c
|
@ -219,6 +219,7 @@ UserAway (const char *nick, const char *awaymsg)
|
|||
|
||||
u = finduser (nick);
|
||||
if (u) {
|
||||
strlcpy(u->awaymsg, awaymsg, MAXHOST);
|
||||
AddStringToList (&av, u->nick, &ac);
|
||||
if ((u->is_away == 1) && (!awaymsg)) {
|
||||
u->is_away = 0;
|
||||
|
|
Reference in a new issue