|
|
|
@ -9,6 +9,7 @@
|
|
|
|
|
#include "model/server.h"
|
|
|
|
|
#include "model/account.h"
|
|
|
|
|
#include "model/status.h"
|
|
|
|
|
#include "model/emoji.h"
|
|
|
|
|
#include "model/media.h"
|
|
|
|
|
#include "model/ap/outbox_envelope.h"
|
|
|
|
|
#include "model/ap/activity/rsa_signature_2017.h"
|
|
|
|
@ -360,12 +361,8 @@ int ap_activity_like( struct status* s )
|
|
|
|
|
struct ap_activity* ap_activity_create_note( struct status* s )
|
|
|
|
|
{
|
|
|
|
|
struct ap_activity* act = ap_activity_new();
|
|
|
|
|
struct account* a = account_from_id( s->account_id );
|
|
|
|
|
|
|
|
|
|
act->id = aformat( "https://%s/note/%d", g_server_name, s->id );
|
|
|
|
|
act->type = apat_note;
|
|
|
|
|
act->actor = strdup( a->account_url );
|
|
|
|
|
act->attributed_to = strdup( a->account_url );
|
|
|
|
|
act->published = s->published;
|
|
|
|
|
act->source.content = strdup(s->source);
|
|
|
|
|
act->content.content = strdup(status_render_source(s));
|
|
|
|
@ -374,6 +371,13 @@ struct ap_activity* ap_activity_create_note( struct status* s )
|
|
|
|
|
act->in_reply_to = strdup( s_in_reply_to->url );
|
|
|
|
|
status_free(s_in_reply_to);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* set account related parameters */ {
|
|
|
|
|
struct account* a = account_from_id( s->account_id );
|
|
|
|
|
act->actor = strdup( a->account_url );
|
|
|
|
|
act->attributed_to = strdup( a->account_url );
|
|
|
|
|
account_free(a);
|
|
|
|
|
}
|
|
|
|
|
char* str = strdup("https://www.w3.org/ns/activitystreams#Public");
|
|
|
|
|
array_append( &act->to, sizeof(str), &str );
|
|
|
|
|
|
|
|
|
@ -393,6 +397,23 @@ struct ap_activity* ap_activity_create_note( struct status* s )
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for( int i = 0; i < s->emoji.count; ++i ) {
|
|
|
|
|
struct emoji* e = s->emoji.items[i];
|
|
|
|
|
|
|
|
|
|
struct ap_activity_tag* tag;
|
|
|
|
|
tag = malloc(sizeof(*tag));
|
|
|
|
|
memset(tag,0,sizeof(*tag));
|
|
|
|
|
|
|
|
|
|
tag->type = aptag_emoji;
|
|
|
|
|
tag->updated = time(NULL);
|
|
|
|
|
tag->icon.url = strdup(e->url);
|
|
|
|
|
tag->id = strdup(e->url);
|
|
|
|
|
tag->icon.type = apot_image;
|
|
|
|
|
tag->name = aformat(":%s:", e->shortcode );
|
|
|
|
|
|
|
|
|
|
array_append( &act->tags, sizeof(tag), &tag );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
str = aformat( "https://%s/owner/followers", g_server_name );
|
|
|
|
|
array_append( &act->cc, sizeof(str), &str );
|
|
|
|
|
|
|
|
|
@ -409,9 +430,10 @@ struct ap_activity* ap_activity_create_note( struct status* s )
|
|
|
|
|
tag->href = strdup(mentioned->account_url);
|
|
|
|
|
tag->name = aformat( "%s@%s", mentioned->handle, mentioned->server );
|
|
|
|
|
array_append( &act->tags, sizeof(tag), &tag );
|
|
|
|
|
|
|
|
|
|
account_free(mentioned);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
account_free(a);
|
|
|
|
|
return act;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|