6 #include "../lib/sstring.h"
7 #include "../lib/irc_string.h"
14 haccount
*haccount_get_by_name(const char *name
)
25 for (;tmp
;tmp
= tmp
->next
)
26 if (!ircd_strcmp(tmp
->name
->content
, name
))
32 haccount
*haccount_add(const char *name
, hlevel lvl
)
34 haccount
*tmp
= (haccount
*)malloc(sizeof (haccount
));
36 if (haccount_get_by_name(name
))
38 Error("helpmod", ERR_ERROR
, "Attempt to add a duplicate account: %s", name
);
39 return haccount_get_by_name(name
);
45 tmp
->name
= getsstring(name
, strlen(name
));
47 tmp
->flags
= H_ACCFLAGS_DEFAULT
;
48 tmp
->last_activity
= time(NULL
);
51 tmp
->next
= haccounts
;
57 int haccount_del(haccount
*hack
)
59 huser
*h_ptr
= husers
;
60 haccount
**ptr
= &haccounts
;
62 for (;h_ptr
;h_ptr
= h_ptr
->next
)
63 if (h_ptr
->account
== hack
)
64 h_ptr
->account
= NULL
;
66 for (;*ptr
;ptr
= &(*ptr
)->next
)
69 hstat_account
*tmp_stat
;
70 haccount
*tmp
= (*ptr
)->next
;
74 tmp_stat
= (*ptr
)->stats
->next
;
76 (*ptr
)->stats
= tmp_stat
;
79 freesstring((*ptr
)->name
);
89 void haccount_clear_inactives(void)
91 haccount
**ptr
= &haccounts
;
93 if ((time(NULL
) - (*ptr
)->last_activity
> HELPMOD_ACCOUNT_EXPIRATION
[(*ptr
)->level
]) && !((*ptr
)->flags
& H_NO_EXPIRE
))
99 void haccount_set_level(haccount
*hack
, hlevel lvl
)
106 const char *haccount_get_state(haccount
* hacc
, int mask
)
108 if (hacc
->flags
& mask
)
114 int haccount_count(hlevel lvl
)
116 haccount
*hacc
= haccounts
;
118 for (;hacc
;hacc
= hacc
->next
)
121 else if (hacc
->level
== lvl
)
126 const char *haccount_get_sname(int index
)
131 return "Send replies as private messages";
133 return "Send replies as notices";
135 return "Do not send verbose messages";
137 return "Auto-op on join";
139 return "Auto-voice on join";
141 return "Suppress unknown command error";
143 return "Error. Please contact strutsi";