aboutsummaryrefslogtreecommitdiff
path: root/general_network.c
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2024-06-24 15:03:06 -0400
committerTest_User <hax@andrewyu.org>2024-06-24 15:03:06 -0400
commit99449f390c045b25ac1ddb1fa406b7a371523182 (patch)
tree6c68d8bdcc33daaf55d56b46ddea7f8d7c24d008 /general_network.c
parentd095efe06273ec29bdc07c2cc522d6fe5a793550 (diff)
downloadhaxircd-99449f390c045b25ac1ddb1fa406b7a371523182.tar.gz
haxircd-99449f390c045b25ac1ddb1fa406b7a371523182.zip
More services stuff
Diffstat (limited to 'general_network.c')
-rw-r--r--general_network.c46
1 files changed, 29 insertions, 17 deletions
diff --git a/general_network.c b/general_network.c
index f6c264a..70ebe60 100644
--- a/general_network.c
+++ b/general_network.c
@@ -333,6 +333,8 @@ int add_user(struct string from, struct string attached_to, struct string uid, s
new_info->account_name = (struct string){.data = malloc(0), .len = 0};
new_info->oper_type = (struct string){.data = malloc(0), .len = 0};
+ new_info->cert = (struct string){.data = malloc(0), .len = 0};
+ new_info->cert_ready = 0;
#ifdef USE_SERVER
if (protocols_handle_new_user(from, new_info) != 0)
@@ -435,6 +437,7 @@ void remove_user(struct string from, struct user_info *user, struct string reaso
free(user->address.data);
free(user->oper_type.data);
free(user->account_name.data);
+ free(user->cert.data);
free(user);
}
@@ -503,6 +506,31 @@ int set_account(struct string from, struct user_info *user, struct string accoun
return 0;
}
+int set_cert(struct string from, struct user_info *user, struct string cert, struct string source) {
+ if (STRING_EQ(user->cert, cert) && user->cert_ready != 0)
+ return 0;
+
+ struct string tmp;
+ if (str_clone(&tmp, cert) != 0)
+ return 1;
+
+#ifdef USE_SERVER
+ if (protocols_handle_set_cert(from, user, cert, source) != 0) {
+ free(tmp.data);
+ return 1;
+ }
+
+ protocols_propagate_set_cert(from, user, cert, source);
+#endif
+
+ user->cert_ready = 1;
+
+ free(user->cert.data);
+ user->cert = 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);
@@ -709,23 +737,7 @@ int privmsg(struct string from, struct string sender, struct string target, stru
#endif
#ifdef USE_PSEUDOCLIENTS
- if ((user && user->is_pseudoclient && user->pseudoclient == HAXSERV_PSEUDOCLIENT) || (!user && !server)) {
- char send;
- if (!user && !server) {
- send = 0;
- for (size_t i = 0; i < channel->user_list.len; i++) {
- struct user_info *user = channel->user_list.array[i].ptr;
- if (user->is_pseudoclient && user->pseudoclient == HAXSERV_PSEUDOCLIENT && !STRING_EQ(sender, user->uid)) {
- send = 1;
- break;
- }
- }
- } else {
- send = 1;
- }
- if (send)
- pseudoclients[HAXSERV_PSEUDOCLIENT].handle_privmsg(from, sender, target, msg);
- }
+ pseudoclients_handle_privmsg(from, sender, target, msg);
#endif
return 0;