summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/main.c b/main.c
index c8cba6f..39164d1 100644
--- a/main.c
+++ b/main.c
@@ -19,13 +19,14 @@ int usage(void)
19 printf("httpd {basedir} Starts the HTTPD daemon\n"); 19 printf("httpd {basedir} Starts the HTTPD daemon\n");
20 printf("webfinger {basedir} {user} Queries about a @user@host or actor\n"); 20 printf("webfinger {basedir} {user} Queries about a @user@host or actor\n");
21 printf("queue {basedir} {uid} Processes a user queue\n"); 21 printf("queue {basedir} {uid} Processes a user queue\n");
22 printf("follow {basedir} {uid} {actor} Follows an actor\n");
23
22// printf("check {basedir} [{uid}] Checks the database\n"); 24// printf("check {basedir} [{uid}] Checks the database\n");
23// printf("purge {basedir} [{uid}] Purges old data\n"); 25// printf("purge {basedir} [{uid}] Purges old data\n");
24// printf("adduser {basedir} [{uid}] Adds a new user\n"); 26// printf("adduser {basedir} [{uid}] Adds a new user\n");
25 27
26// printf("update {basedir} {uid} Sends a user update to followers\n"); 28// printf("update {basedir} {uid} Sends a user update to followers\n");
27// printf("passwd {basedir} {uid} Sets the password for {uid}\n"); 29// printf("passwd {basedir} {uid} Sets the password for {uid}\n");
28// printf("follow {basedir} {uid} {actor} Follows an actor\n");
29// printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n"); 30// printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n");
30// printf("mute {basedir} {uid} {actor} Mutes an actor\n"); 31// printf("mute {basedir} {uid} {actor} Mutes an actor\n");
31// printf("unmute {basedir} {uid} {actor} Unmutes an actor\n"); 32// printf("unmute {basedir} {uid} {actor} Unmutes an actor\n");
@@ -124,8 +125,29 @@ int main(int argc, char *argv[])
124 if (msg != NULL) { 125 if (msg != NULL) {
125 post(&snac, msg); 126 post(&snac, msg);
126 127
127 xs *j = xs_json_dumps_pp(msg, 4); 128 if (dbglevel) {
128 printf("%s\n", j); 129 xs *j = xs_json_dumps_pp(msg, 4);
130 printf("%s\n", j);
131 }
132 }
133
134 return 0;
135 }
136
137 if (strcmp(cmd, "follow") == 0) {
138 xs *msg = msg_follow(&snac, url);
139
140 if (msg != NULL) {
141 char *actor = xs_dict_get(msg, "object");
142
143 following_add(&snac, actor, msg);
144
145 enqueue_output(&snac, msg, actor, 0);
146
147 if (dbglevel) {
148 xs *j = xs_json_dumps_pp(msg, 4);
149 printf("%s\n", j);
150 }
129 } 151 }
130 152
131 return 0; 153 return 0;
@@ -164,7 +186,6 @@ int main(int argc, char *argv[])
164 } 186 }
165 187
166 if (strcmp(cmd, "note") == 0) { 188 if (strcmp(cmd, "note") == 0) {
167 int status;
168 xs *content = NULL; 189 xs *content = NULL;
169 xs *msg = NULL; 190 xs *msg = NULL;
170 xs *c_msg = NULL; 191 xs *c_msg = NULL;
@@ -194,7 +215,7 @@ int main(int argc, char *argv[])
194 215
195 c_msg = msg_create(&snac, msg); 216 c_msg = msg_create(&snac, msg);
196 217
197 { 218 if (dbglevel) {
198 xs *j = xs_json_dumps_pp(c_msg, 4); 219 xs *j = xs_json_dumps_pp(c_msg, 4);
199 printf("%s\n", j); 220 printf("%s\n", j);
200 } 221 }