diff options
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/activitypub.c b/activitypub.c index 5c98389..8e17daa 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -160,14 +160,16 @@ int timeline_request(snac *snac, char **id, d_char **wrk) | |||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | 162 | ||
| 163 | int send_to_inbox(snac *snac, char *inbox, char *msg, d_char **payload, int *p_size, int timeout) | 163 | int send_to_inbox_raw(const char *keyid, const char *seckey, |
| 164 | const xs_str *inbox, const xs_dict *msg, | ||
| 165 | xs_val **payload, int *p_size, int timeout) | ||
| 164 | /* sends a message to an Inbox */ | 166 | /* sends a message to an Inbox */ |
| 165 | { | 167 | { |
| 166 | int status; | 168 | int status; |
| 167 | d_char *response; | 169 | xs_dict *response; |
| 168 | xs *j_msg = xs_json_dumps_pp(msg, 4); | 170 | xs *j_msg = xs_json_dumps_pp((xs_dict *)msg, 4); |
| 169 | 171 | ||
| 170 | response = http_signed_request(snac, "POST", inbox, | 172 | response = http_signed_request_raw(keyid, seckey, "POST", inbox, |
| 171 | NULL, j_msg, strlen(j_msg), &status, payload, p_size, timeout); | 173 | NULL, j_msg, strlen(j_msg), &status, payload, p_size, timeout); |
| 172 | 174 | ||
| 173 | xs_free(response); | 175 | xs_free(response); |
| @@ -176,6 +178,16 @@ int send_to_inbox(snac *snac, char *inbox, char *msg, d_char **payload, int *p_s | |||
| 176 | } | 178 | } |
| 177 | 179 | ||
| 178 | 180 | ||
| 181 | int send_to_inbox(snac *snac, const xs_str *inbox, const xs_dict *msg, | ||
| 182 | xs_val **payload, int *p_size, int timeout) | ||
| 183 | /* sends a message to an Inbox */ | ||
| 184 | { | ||
| 185 | char *seckey = xs_dict_get(snac->key, "secret"); | ||
| 186 | |||
| 187 | return send_to_inbox_raw(snac->actor, seckey, inbox, msg, payload, p_size, timeout); | ||
| 188 | } | ||
| 189 | |||
| 190 | |||
| 179 | d_char *get_actor_inbox(snac *snac, char *actor) | 191 | d_char *get_actor_inbox(snac *snac, char *actor) |
| 180 | /* gets an actor's inbox */ | 192 | /* gets an actor's inbox */ |
| 181 | { | 193 | { |