aboutsummaryrefslogtreecommitdiff
path: root/general_network.c
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2024-06-13 01:36:55 -0400
committerTest_User <hax@andrewyu.org>2024-06-13 01:36:55 -0400
commitd20eea410dafb444e3bdfa5fab44d166ea588304 (patch)
tree35ccda5d6495b630956b9243dacb39959c06e274 /general_network.c
parent74937a810bff43ba7ce20a8a64149ffd3ab896e9 (diff)
downloadhaxircd-d20eea410dafb444e3bdfa5fab44d166ea588304.tar.gz
haxircd-d20eea410dafb444e3bdfa5fab44d166ea588304.zip
nick and kill support
Diffstat (limited to 'general_network.c')
-rw-r--r--general_network.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/general_network.c b/general_network.c
index 432faa0..ad7016c 100644
--- a/general_network.c
+++ b/general_network.c
@@ -284,6 +284,34 @@ int add_user(struct string from, struct string attached_to, struct string uid, s
return 1;
}
+int rename_user(struct string from, struct user_info *user, struct string nick, size_t timestamp) {
+ struct string timestamp_str;
+ if (unsigned_to_str(timestamp, &timestamp_str) != 0)
+ return 1;
+
+ void *tmp = malloc(nick.len);
+ if (!tmp) {
+ free(timestamp_str.data);
+ return 1;
+ }
+
+#ifdef USE_SERVER
+#ifdef USE_HAXIRCD_PROTOCOL
+ protocols[HAXIRCD_PROTOCOL].propagate_rename_user(from, user, nick, timestamp, timestamp_str);
+#endif
+#ifdef USE_INSPIRCD2_PROTOCOL
+ protocols[INSPIRCD2_PROTOCOL].propagate_rename_user(from, user, nick, timestamp, timestamp_str);
+#endif
+#endif
+
+ free(user->nick.data);
+ user->nick.data = tmp;
+ memcpy(user->nick.data, nick.data, nick.len);
+ user->nick.len = nick.len;
+
+ return 0;
+}
+
void remove_user(struct string from, struct user_info *user, struct string reason, char propagate) {
#ifdef USE_SERVER
if (propagate) {
@@ -318,3 +346,16 @@ void remove_user(struct string from, struct user_info *user, struct string reaso
free(user->address.data);
free(user);
}
+
+void kill_user(struct string from, struct string source, struct user_info *user, struct string reason) {
+#ifdef USE_SERVER
+#ifdef USE_HAXIRCD_PROTOCOL
+ protocols[HAXIRCD_PROTOCOL].propagate_kill_user(from, source, user, reason);
+#endif
+#ifdef USE_INSPIRCD2_PROTOCOL
+ protocols[INSPIRCD2_PROTOCOL].propagate_kill_user(from, source, user, reason);
+#endif
+#endif
+
+ remove_user(from, user, reason, 0);
+}