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
)
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
= (haccount
*)malloc(sizeof (haccount
));
46 tmp
->name
= getsstring(name
, strlen(name
));
48 tmp
->flags
= H_ACCFLAGS_DEFAULT
;
49 tmp
->last_activity
= time(NULL
);
52 tmp
->next
= haccounts
;
58 int haccount_del(haccount
*hack
)
60 huser
*h_ptr
= husers
;
61 haccount
**ptr
= &haccounts
;
63 for (;h_ptr
;h_ptr
= h_ptr
->next
)
64 if (h_ptr
->account
== hack
)
65 h_ptr
->account
= NULL
;
67 for (;*ptr
;ptr
= &(*ptr
)->next
)
70 hstat_account
*tmp_stat
;
71 haccount
*tmp
= (*ptr
)->next
;
75 tmp_stat
= (*ptr
)->stats
->next
;
77 (*ptr
)->stats
= tmp_stat
;
80 freesstring((*ptr
)->name
);
90 void haccount_clear_inactives(void)
92 haccount
**ptr
= &haccounts
;
94 if ((time(NULL
) - (*ptr
)->last_activity
> HELPMOD_ACCOUNT_EXPIRATION
[(*ptr
)->level
]) && !((*ptr
)->flags
& H_NO_EXPIRE
))
100 void haccount_set_level(haccount
*hack
, hlevel lvl
)
107 const char *haccount_get_state(haccount
* hacc
, int mask
)
109 if (hacc
->flags
& mask
)
115 int haccount_count(hlevel lvl
)
117 haccount
*hacc
= haccounts
;
119 for (;hacc
;hacc
= hacc
->next
)
122 else if (hacc
->level
== lvl
)
127 const char *haccount_get_sname(int index
)
132 return "Send replies as private messages";
134 return "Send replies as notices";
136 return "Do not send verbose messages";
138 return "Auto-op on join";
140 return "Auto-voice on join";
142 return "Suppress unknown command error";
144 return "Error. Please contact strutsi";