mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
New boolean argument 'priv' to msg_note().
This commit is contained in:
parent
9083bef5cb
commit
5230435b31
4 changed files with 11 additions and 7 deletions
|
@ -632,7 +632,8 @@ d_char *msg_follow(snac *snac, char *url_or_uid)
|
|||
}
|
||||
|
||||
|
||||
xs_dict *msg_note(snac *snac, xs_str *content, xs_val *rcpts, xs_str *in_reply_to, xs_list *attach)
|
||||
xs_dict *msg_note(snac *snac, xs_str *content, xs_val *rcpts,
|
||||
xs_str *in_reply_to, xs_list *attach, int priv)
|
||||
/* creates a 'Note' message */
|
||||
{
|
||||
xs *ntid = tid(0);
|
||||
|
@ -702,8 +703,7 @@ xs_dict *msg_note(snac *snac, xs_str *content, xs_val *rcpts, xs_str *in_reply_t
|
|||
ctxt = xs_dup(v);
|
||||
|
||||
/* if this message is public, ours will also be */
|
||||
if (is_msg_public(snac, p_msg) &&
|
||||
xs_list_in(to, public_address) == -1)
|
||||
if (!priv && is_msg_public(snac, p_msg) && xs_list_in(to, public_address) == -1)
|
||||
to = xs_list_append(to, public_address);
|
||||
}
|
||||
|
||||
|
@ -749,7 +749,7 @@ xs_dict *msg_note(snac *snac, xs_str *content, xs_val *rcpts, xs_str *in_reply_t
|
|||
}
|
||||
|
||||
/* no recipients? must be for everybody */
|
||||
if (xs_list_len(to) == 0)
|
||||
if (!priv && xs_list_len(to) == 0)
|
||||
to = xs_list_append(to, public_address);
|
||||
|
||||
/* delete all cc recipients that also are in the to */
|
||||
|
|
3
html.c
3
html.c
|
@ -1392,6 +1392,7 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
|
|||
char *edit_id = xs_dict_get(p_vars, "edit_id");
|
||||
char *alt_text = xs_dict_get(p_vars, "alt_text");
|
||||
xs *attach_list = xs_list_new();
|
||||
int priv = 0;
|
||||
|
||||
/* default alt text */
|
||||
if (xs_is_null(alt_text))
|
||||
|
@ -1436,7 +1437,7 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
|
|||
xs *c_msg = NULL;
|
||||
xs *content_2 = xs_replace(content, "\r", "");
|
||||
|
||||
msg = msg_note(&snac, content_2, to, in_reply_to, attach_list);
|
||||
msg = msg_note(&snac, content_2, to, in_reply_to, attach_list, priv);
|
||||
|
||||
if (sensitive != NULL) {
|
||||
xs *t = xs_val_new(XSTYPE_TRUE);
|
||||
|
|
2
main.c
2
main.c
|
@ -292,7 +292,7 @@ int main(int argc, char *argv[])
|
|||
else
|
||||
content = xs_dup(url);
|
||||
|
||||
msg = msg_note(&snac, content, NULL, in_reply_to, NULL);
|
||||
msg = msg_note(&snac, content, NULL, in_reply_to, NULL, 0);
|
||||
|
||||
c_msg = msg_create(&snac, msg);
|
||||
|
||||
|
|
5
snac.h
5
snac.h
|
@ -170,7 +170,10 @@ const char *default_avatar_base64(void);
|
|||
d_char *msg_admiration(snac *snac, char *object, char *type);
|
||||
d_char *msg_create(snac *snac, char *object);
|
||||
d_char *msg_follow(snac *snac, char *actor);
|
||||
xs_dict *msg_note(snac *snac, xs_str *content, xs_val *rcpts, xs_str *in_reply_to, xs_list *attach);
|
||||
|
||||
xs_dict *msg_note(snac *snac, xs_str *content, xs_val *rcpts,
|
||||
xs_str *in_reply_to, xs_list *attach, int priv);
|
||||
|
||||
d_char *msg_undo(snac *snac, char *object);
|
||||
d_char *msg_delete(snac *snac, char *id);
|
||||
d_char *msg_actor(snac *snac);
|
||||
|
|
Loading…
Reference in a new issue