summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2024-03-15 18:09:52 -0400
committerTest_User <hax@andrewyu.org>2024-03-15 18:09:52 -0400
commit6d8a3bd375f6cd240349fcf0e99ce4a48b9d1f38 (patch)
treeff4e4a597d83fe81f6e9235a4dce786aa8ee44df
parent8fef1ea4dc6076f74a47a087cf3936819172926e (diff)
downloadcoupserv-6d8a3bd375f6cd240349fcf0e99ce4a48b9d1f38.tar.gz
coupserv-6d8a3bd375f6cd240349fcf0e99ce4a48b9d1f38.zip
bug fixing
-rw-r--r--client_network.c13
-rw-r--r--main.c5
2 files changed, 8 insertions, 10 deletions
diff --git a/client_network.c b/client_network.c
index 46e9342..f786ac6 100644
--- a/client_network.c
+++ b/client_network.c
@@ -308,19 +308,18 @@ int client_join_handler(uint64_t argc, struct string *argv) {
if (argc < 1)
return 1;
- char current_time_nulstr[22];
- uint64_t current_time;
- { // Mostly to get rid of the compiler complaining about conversion to unsigned
- time_t ctime = time(NULL);
+ time_t ctime = time(NULL);
+
+ struct string channels = argv[0];
+ while (1) {
+ char current_time_nulstr[22];
+ uint64_t current_time;
if (ctime < 0) {
WRITES(2, STRING("Please check your clock.\n"));
return 1;
}
current_time = (uint64_t)ctime;
- }
- struct string channels = argv[0];
- while (1) {
uint64_t offset = 0;
while (offset < channels.len && channels.data[offset] != ',')
diff --git a/main.c b/main.c
index 647da81..50126a8 100644
--- a/main.c
+++ b/main.c
@@ -308,8 +308,8 @@ int main(void) {
}
struct string source;
- if (full_msg.data[0] == ':') {
- source.data = full_msg.data + 1;
+ if (full_msg.data[offset] == ':') {
+ source.data = full_msg.data + 1 + offset;
found = 0;
for (uint64_t i = offset + 1; i < msg_len; i++) {
if (full_msg.data[i] == ' ') {
@@ -325,7 +325,6 @@ int main(void) {
}
} else {
source = (struct string){0};
- offset = 0;
}
while (offset < msg_len && full_msg.data[offset] == ' ')