diff options
Diffstat (limited to 'general_network.c')
-rw-r--r-- | general_network.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/general_network.c b/general_network.c index 2b055c2..a5251c6 100644 --- a/general_network.c +++ b/general_network.c @@ -273,9 +273,12 @@ int add_user(struct string from, struct string attached_to, struct string uid, s if (str_clone(&(new_info->address), address) != 0) goto add_user_free_host; - if (set_table_index(&user_list, uid, new_info) != 0) + if (str_clone(&(new_info->oper_type), STRING("")) != 0) goto add_user_free_address; + if (set_table_index(&user_list, uid, new_info) != 0) + goto add_user_free_oper_type; + if (set_table_index(&(attached->user_list), uid, new_info) != 0) goto add_user_remove_user_list; @@ -295,6 +298,8 @@ int add_user(struct string from, struct string attached_to, struct string uid, s add_user_remove_user_list: remove_table_index(&user_list, uid); + add_user_free_oper_type: + free(new_info->oper_type.data); add_user_free_address: free(new_info->address.data); add_user_free_host: @@ -379,6 +384,7 @@ void remove_user(struct string from, struct user_info *user, struct string reaso free(user->vhost.data); free(user->host.data); free(user->address.data); + free(user->oper_type.data); free(user); } @@ -412,6 +418,26 @@ int kill_user(struct string from, struct string source, struct user_info *user, return 0; } +int oper_user(struct string from, struct user_info *user, struct string type) { + struct string tmp; + if (str_clone(&tmp, type) != 0) + return 1; + +#ifdef USE_SERVER +#ifdef USE_HAXIRCD_PROTOCOL + protocols[HAXIRCD_PROTOCOL].propagate_oper_user(from, user, type); +#endif +#ifdef USE_INSPIRCD2_PROTOCOL + protocols[INSPIRCD2_PROTOCOL].propagate_oper_user(from, user, type); +#endif +#endif + + free(user->oper_type.data); + user->oper_type = tmp; + + return 0; +} + int set_channel(struct string from, struct string name, size_t timestamp, size_t user_count, struct user_info **users) { char is_new_channel; struct channel_info *channel = get_table_index(channel_list, name); |