|
|
|
@ -13,7 +13,7 @@
|
|
|
|
|
#include "model/ap/activity.h"
|
|
|
|
|
#include "model/ap/inbox_envelope.h"
|
|
|
|
|
#include "model/crypto/http_sign.h"
|
|
|
|
|
#include "model/timeline.h"
|
|
|
|
|
//#include "model/timeline.h"
|
|
|
|
|
|
|
|
|
|
// Stdlib
|
|
|
|
|
#include <stdio.h>
|
|
|
|
@ -123,13 +123,6 @@ static bool route_undo_activity( struct ap_activity* act )
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void add_post_to_timeline( int timeline_id, struct status* s )
|
|
|
|
|
{
|
|
|
|
|
struct timeline* tl = timeline_from_id(timeline_id);
|
|
|
|
|
timeline_add_post( tl, s );
|
|
|
|
|
timeline_free(tl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool route_follower_post( struct ap_activity* act )
|
|
|
|
|
{
|
|
|
|
|
// Requires an object
|
|
|
|
@ -154,9 +147,9 @@ static bool route_follower_post( struct ap_activity* act )
|
|
|
|
|
status_save_new(s);
|
|
|
|
|
|
|
|
|
|
// Add to timelines
|
|
|
|
|
add_post_to_timeline( 1, s );
|
|
|
|
|
add_post_to_timeline( 2, s );
|
|
|
|
|
add_post_to_timeline( actor_account->id, s );
|
|
|
|
|
status_add_to_timeline( s, home_timeline_id );
|
|
|
|
|
status_add_to_timeline( s, public_timeline_id );
|
|
|
|
|
status_add_to_timeline( s, actor_account->id );
|
|
|
|
|
|
|
|
|
|
// TODO: create notification if user notifications are on or this is part of a watched conversation
|
|
|
|
|
|
|
|
|
@ -174,7 +167,7 @@ static bool route_mention( struct ap_activity* act )
|
|
|
|
|
for( int i = 0; i < obj->tags.count; ++i ) {
|
|
|
|
|
struct ap_activity_tag* tag = obj->tags.items[i];
|
|
|
|
|
|
|
|
|
|
//printf( "tag = { &=%p, .type=%d, .href=%s, .name=%s }\n", tag, tag->type, tag->href, tag->name );
|
|
|
|
|
printf( "tag = { &=%p, .type=%d, .href=%s, .name=%s }\n", tag, tag->type, tag->href, tag->name );
|
|
|
|
|
|
|
|
|
|
if( tag->type != aptag_mention ) { continue; }
|
|
|
|
|
if( 0 == strcmp(tag->href, owner_url) ) { goto does_mention; }
|
|
|
|
@ -199,10 +192,8 @@ does_mention:
|
|
|
|
|
status_save_new(s);
|
|
|
|
|
|
|
|
|
|
// Add status to account timeline
|
|
|
|
|
struct timeline* tl = timeline_from_id( mentioner->id );
|
|
|
|
|
printf( "tl->id=%d, s->id=%d\n", tl->id, s->id );
|
|
|
|
|
timeline_add_post(tl,s);
|
|
|
|
|
timeline_free(tl);
|
|
|
|
|
status_add_to_timeline( s, mentioner->id );
|
|
|
|
|
status_add_to_timeline( s, owner_account_id );
|
|
|
|
|
|
|
|
|
|
// Create notification
|
|
|
|
|
struct notification* note = notification_new();
|
|
|
|
@ -272,8 +263,10 @@ static bool route_emoji_react( struct ap_activity* act )
|
|
|
|
|
|
|
|
|
|
static bool route_create( struct ap_activity* act )
|
|
|
|
|
{
|
|
|
|
|
return route_follower_post(act)
|
|
|
|
|
|| route_mention(act);
|
|
|
|
|
return
|
|
|
|
|
route_mention(act)
|
|
|
|
|
|| route_follower_post(act)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|