aboutsummaryrefslogtreecommitdiff
path: root/ctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'ctl.c')
-rw-r--r--ctl.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/ctl.c b/ctl.c
index bab653e..64934cc 100644
--- a/ctl.c
+++ b/ctl.c
@@ -20,13 +20,34 @@ printdate(int timestamp)
printf(buf);
}
+/*
+ * The `new' functions provide a way to add a new attachment/post/user.
+ * On GET, they show a form. On POST, they insert the posted information
+ * into the database.
+ */
+void
+newatt()
+{}
+
+void
+newpost()
+{}
+
+void
+newuser()
+{}
+
+/*
+ * The `show' functions show an existing attachment/post/user
+ * or some other type of page.
+ */
void
showatt(id)
{
struct att *att;
if(!(att = getatt(selectbyint("atts", "oid", id)))){
- srverr("Could not retrieve att");
+ srverr("Could not retrieve attachment");
return;
}
@@ -83,7 +104,7 @@ showpost(int id)
stmt = selectbyint("atts", "post", id);
- title = site.name;
+ title = post->subject;
printf("Content-Type: text/html\n\n");
#include "t/post.tc"
free(user);
@@ -93,7 +114,7 @@ showpost(int id)
void
showuser(int id)
{
- char *title;
+ char title[120];
sqlite3_stmt *stmt;
struct post *post;
struct user *user;
@@ -111,7 +132,7 @@ showuser(int id)
if(sqlite3_bind_int(stmt, 1, id) != SQLITE_OK)
goto err;
- title = site.name;
+ snprintf(title, 120, "User: %s", user->full? user->full: user->name);
printf("Content-Type: text/html\n\n");
#include "t/user.tc"
free(user);