aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs.txt1
-rw-r--r--laim.c24
2 files changed, 18 insertions, 7 deletions
diff --git a/docs.txt b/docs.txt
index 2eb28f0..620b29d 100644
--- a/docs.txt
+++ b/docs.txt
@@ -46,6 +46,7 @@ S csv:targets body sends mail
H csv:targets num:ttl body sends mail with an expiry date (targets, ttl, body) 7|.|!|O
W returns who you are (may get funky) str+\n
E count inbox size (including deleted mail) num+\n
+Z print room topic (str+\n)|!
U list all users on this instance "name lastlogin\n"[]+O
R list all rooms on this instance "title onlinecount\n"[]+O
B [str]:roomname enter a room O
diff --git a/laim.c b/laim.c
index 0692e5f..fa602f2 100644
--- a/laim.c
+++ b/laim.c
@@ -1,4 +1,4 @@
-// laim (0.2.6b3): a lame mail server
+// laim (0.2.6b4): a lame mail server
//
// creator: moon flower fields
// website: coffin.ir
@@ -598,11 +598,11 @@ int main(int argc, char **argv) {
flush();
return 1;
}
- char path[ 4096 ] = { 0 };
- u64 bye = readlink("/proc/self/exe", path, sizeof(path) - 1);
- char *new_argv[] = { "tcpsvd", "-v", argv[ 2 ], argv[ 3 ], "ssl_server", "-f", argv[ 4 ], path, NULL };
- char *new_argv_blim[] = { "tcpsvd", "-v", "-c", "2048", "-C", "16", argv[ 2 ], argv[ 3 ], "ssl_server",
- "-f", argv[ 4 ], path, NULL };
+ char path[ 4096 ] = { 0 };
+ u64 bye = readlink("/proc/self/exe", path, sizeof(path) - 1);
+ char *new_argv[] = { "tcpsvd", "-v", argv[ 2 ], argv[ 3 ], "ssl_server", "-f", argv[ 4 ], path, NULL };
+ char *new_argv_blim[]
+ = { "tcpsvd", "-v", "-c", "2048", "-C", "16", argv[ 2 ], argv[ 3 ], "ssl_server", "-f", argv[ 4 ], path, NULL };
execvp("busybox", blim ? new_argv_blim : new_argv);
writes("failed to start. errno: ");
print_u64((*__errno_location()));
@@ -624,7 +624,6 @@ int main(int argc, char **argv) {
// mail/ - mails directory, each filename is a username
mkdir("users", 0700);
mkdir("mail", 0700);
- mkdir("limits", 0700);
laim_start:;
memzero(user, 65);
@@ -747,6 +746,17 @@ laim_start:;
close(count_fd);
print_u64(result);
writes("\n");
+ } else if (c == 'Z') {
+ static char topic_filename[ SZ ] = { 0 };
+ sit(topic_filename, filename, ".topic");
+ int topic_fd = open(topic_filename, O_RDONLY);
+ if (topic_fd < 0) err("!");
+
+ char buf[ 256 ];
+ int r;
+ while ((r = read(topic_fd, buf, sizeof(buf))) > 0) writeb(buf, r);
+ close(topic_fd);
+ writes("\n");
} else if (c == 'B') {
leave_room();