-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrswall.h
760 lines (655 loc) · 28.6 KB
/
rswall.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
#pragma once
#include <retroshare/rsgxsifacehelper.h>
#include <retroshare/rsgxscommon.h>
// who cleans up old tokens generated by the dataservice?
// maybe they expire, but i can't find where they get removed
// they can't expire, because dataaccess has only a map<token, status>
/* the life of a token
static const uint8_t GXS_REQUEST_V2_STATUS_FAILED; end if the request failed
static const uint8_t GXS_REQUEST_V2_STATUS_PENDING; token was just created
static const uint8_t GXS_REQUEST_V2_STATUS_PARTIAL;
static const uint8_t GXS_REQUEST_V2_STATUS_FINISHED_INCOMPLETE; unused
static const uint8_t GXS_REQUEST_V2_STATUS_COMPLETE; the request was completed and data is available
static const uint8_t GXS_REQUEST_V2_STATUS_DONE; the client received the data
*/
// idea: have different types of grps and msgs
// maybe have own id types for differen grp and msgs types?
// the interface of RsWall is a mess
// some things have to be requested using ifacehelper, others directly from RsWall
// maybe remove ifacehelper to have one clean set of functions
// bootstrapping, how to learn about new people and new content?
// this is very very important.
// - display a list of friends-of-friends, possible because of circles with friends
// - maybe let people attach tags to their wall so we can check who is interesting/who not
// at least tags would allow something like this: this person also likes ...
// - publish notification about likes and comments on own wall
// the newsfeed then displays "friend x commented on"
// ways of getting data"
// - blocking function gets data and returns it immediately
// - non blocking function returns data if available, else it returns false
// call the function again to get data
// this works only if the data gets cached for a while,
// because the service can't know when the client received it
// - a first function takes arguments and returns a token
// the token has to be checked if the requested data is available
// another function returns the data
// ideas for event multiplexing
// problem: one class genereates events, other classes want to receive these
// - gxs has a very simple event notification system: only one instance of a class polls gxs to receive events
// gxs clears the list of events on every call
// - Qt/Wt Signals and Slots, they automatically destroy connections if sender or receiver is destroyed
// - event listeners register at the event creator with a unique name or their address
// - clients can then poll the event generator, the event generator keeps a list who received what
// - or the event generator calls the event receiver from its own thread
// - new idea: the event generator tags every event with a number
// the clients then ask the server for events since the last number
// the server keeps a list of the events of the last x minutes, clients then have to poll every <x minutes
// criterias:
// - speed, how fast does the event reach its destination?
// - does it work over http or rs-ssh-rpc? what about disconnects of client and server?
// - can clients fail to unregister? what does then happen?
// - for local usage: what about threading? need some mutexes?
// - dependance on external libraries like Qt or boost
// - push or pull? client calls server or server calls client with callback
//
// idea for polled event multiplexing
// - the provider keeps a list of the events of the last 10mins
// - every event has a number
// - clients poll faster than every 10mins for events and include the number of the last event
// the provider then returns all events since the this number or all events if the number is zero
// thoughts about syncing a list of items with a list in the backend
// this is always the same problem: the backend has a list of something
// like friendslist, chatmessages, files, forum posts
// the ui needs the get updated whenever the backend list changes
// maybe there are different guis like qt-gui, rswebui, qml-gui
// data items can also be in a tree structure for forum posts and files
// it is highly desired that the gui only loads as much items from the list as there is space on the sreen
// ideas for the solution:
// - every item has a number or id
// - can then use the id/number of a item to taverse the list by asking for previous/next
// - can then ask for changes in range first-last
// big question:
// a fb page is ver similar to a rs-channel
// would be nice to display channel msgs in the webui
// or display the social network things in the Qt ui
// idea: import content using the feedreader
// can configure in netservice, if groups should be auto synced
// if not can request which groups should be synced, but need peer id for this
// need some flags
// it is desired to have flags in gxs-meta, because this is cheaper to load than full msgs
// and if using available flags, rsgxsdataaccess can do the filtering,
// thus don't have to write own code for filtering
//
// in gxs-grp-meta
// meta->mGroupStatus = GXS_SERV::GXS_GRP_STATUS_UNPROCESSED | GXS_SERV::GXS_GRP_STATUS_UNREAD;
// meta->mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED;
// grp->metaData->mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_ADMIN
// | GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED | GXS_SERV::GROUP_SUBSCRIBE_PUBLISH;
// std::string mServiceString; can be used to store whatever we like
// uint32_t mAuthenFlags; unused?
// RsGxsGroupId mParentGrpId; unused?
// uint32_t mSignFlags; unused?
// uint32_t mGroupFlags; used for three auth types private, restricted, public
// std::string mGroupName; could abuse this
//
// in gxs-msg-meta
// three members to point to other messages: (or can abuse this and store own hash of whatever is there)
// RsGxsMessageId mThreadId;
// RsGxsMessageId mParentId;
// RsGxsMessageId mOrigMsgId;
//
// /// the first 16 bits for service, last 16 for GXS
// question: what means first bits? lower or upper?
// because photoservice and wiki uses lower bits
// and in mMsgStatus gxs uses lower bits
// uint32_t mMsgFlags;
//
// // BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
// // normally READ / UNREAD flags. LOCAL Data.
//
// /// the first 16 bits for service, last 16 for GXS
// uint32_t mMsgStatus;
// use gxs part of msg status like this:
// meta->mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED | GXS_SERV::GXS_MSG_STATUS_UNREAD;
//
// time_t mChildTs;
// std::string mServiceString; // Service Specific Free-Form extra storage.
/*
clean plan
==========
// ************ UI classes **********************
class TokenQueueWt
class UpdateBroadcastWt
class WallWidget
class NewsfeedWidget
class NewPostWidget
class RootPostWidget
class AvatarImageWidget
class WallCommentContainerWidget
class NewCommentWidget
class CommentWidget
class ActionButtonWidget // like, share,
first run pages
later
-----
distant mail
distant chat
chatlobbies
*/
namespace RsWall{
// todo
class NewsfeedEntry;
class RsWall;
// there is a potential name collison with WRasterImage on Ubuntu 14
// so can't call it Image, have to call it WallImage
class WallImage;
class WallGroup;
class PostGroup;
class ReferenceMsg;
class PostMsg;
class PostReferenceParams
{
public:
PostReferenceParams(): mType(0){}
RsGxsGroupId mReferencedGroupId;
RsGxsId mAuthor;
RsGxsId mTargetWallOwner;
RsGxsCircleId mCircle;
uint32_t mType;
};
// to show how others interact with content
// later want to display other activities like "added a friend", "published a photo album"
class Activity
{
public:
// who did what?
std::vector<RsGxsId> mShared;
std::vector<RsGxsId> mCommented;
//std::vector<RsGxsId> mLiked;
// id of a post group
RsGxsGroupId mReferencedGroup;
};
extern RsWall *rsWall;
// ********** interface *************************
class RsWall: public RsGxsIfaceHelper, public RsGxsCommentService
{
public:
RsWall(RsGxsIface *gxs)
:RsGxsIfaceHelper(gxs) { return; }
// poll this to find out what is happening
virtual void getCurrentActivities(std::vector<Activity> &activities) = 0;
// important: newsfeed handling
// the ui has to ask if the newsfeed has new entries
// what is NewsfeedEntry? probably a pair (RsGxsGroupId,RsGxsMsgId)
// RsGxsMsgId can be null to signal that only the RsGxsGroupId is important for the newsfeed
// have to provide type info here, so the ui knows which fn to use to retrieve data
virtual void getNewNewsfeedEntries(std::list<NewsfeedEntry> &feeds) = 0;
// the Retroshare newsfeed has no state across start/stop of retroshare
// do we need to save a newsfeed state to disk?
virtual void createWallGroup(uint32_t &token, const WallGroup &grp) = 0;
virtual void updateWallGroup(uint32_t &token, const WallGroup &grp) = 0;
// how to handle selection of target wall?
// maybe we have different walls private/public
// who fills in the cirlce id?
// probably the service, because he has time and knowledge, and can cache things
virtual void createPost(uint32_t &token, const PostMsg &msg) = 0;
virtual void acknowledgeCreatePost(uint32_t &token) = 0;
// new function, note: the service will fill in params.mReferencedGroupId
virtual void createPost(uint32_t& token, const PostReferenceParams& params, const std::string& postText) = 0;
// this handles sharing on own or friends wall, and like
virtual void createPostReferenceMsg(uint32_t &token, const ReferenceMsg &refMsg) = 0;
// new function to share when author, author of target wall and circle is known
virtual void createPostReferenceMsg(uint32_t &token, const PostReferenceParams& params) = 0;
// use this if you only know the identity of the wall owner
// use request in gxsifacehelper if you want to list all known walls
// (this will be expensive, because have to request all gxs-groups)
// (better have a flag in meta, so have to request meta only?)
// (would be cool if gxs could filter by RsItem-type)
// maybe should return a list of walls, because of public wall and private wall?
// ->merge results from both walls
virtual void requestWallGroupMetas(uint32_t &token, const RsGxsId &identity) = 0;
virtual void getWallGroupMetas(const uint32_t &token, std::vector<RsGroupMetaData>& grpMeta) = 0;
virtual void requestWallGroups(uint32_t &token, const RsGxsId &identity) = 0;
virtual void getWallGroups(const uint32_t &token, std::vector<WallGroup> &wgs) = 0;
virtual void getPostGroup(const uint32_t &token, PostGroup &pg) = 0;
virtual void getPostReferenceMsgs(const uint32_t &token, std::vector<ReferenceMsg> &refMsgs) = 0;
virtual void getPostMsg(const uint32_t &token, PostMsg &pm) = 0;
virtual void getPostMsgs(const uint32_t & token, std::vector<PostMsg> & pms) = 0;
virtual void requestAvatarImage(uint32_t &token, const RsGxsId &identity) = 0;
virtual bool getAvatarImage(const uint32_t &token, WallImage &image) = 0;
virtual bool isAuthorSubscribed(RsGxsId& id, bool& subscribed) = 0;
virtual void subscribeToAuthor(RsGxsId& id, bool subscribe) = 0;
// functions for comment service
// (just a forward to p3GxsCommentService like in p3GxsChannels)
};
/*
// ************* Wall Service ******************
// have two threads: ui thread, rsgenexchange thread
// have to be careful if they cross their ways
class p3WallService: public RsWall, public RsGenExchange, public GxsTokenQueue{
public:
// *********** begin RsWall ***********
// wall iface here
// ************ end RsWall ************
// from RsGenExchange
// this is called by RsGenExchange
virtual void notifyChanges(std::vector<RsGxsNotify*>& changes);
// from RsGenExchange
// this is called by RsGenExchange runner thread
virtual void service_tick();
// from RsGenExchange
virtual RsServiceInfo getServiceInfo();
// from GxsTokenQueue
virtual void handleResponse(uint32_t token, uint32_t req_type);
private:
// check if we want to subscribe to incoming groups
// detect interesting group-ids in messages
virtual void _checkSubscribe(std::vector<RsGxsNotify*>& changes);
// set to collect wanted groups
std::set<RsGxsGroupId> _mGroupsToSubscribe;
// collect info about incoming groups and messages
// generate newsfeed entries from it
// first this will just record interesting things by by timestamp
// later we maybe want a filter with for example 5 mins delay
// and then rate all messages in this period and filter some out
// lets see how much content a user receives,
// if its to much think about filters
// the user probably wants to tune the filter
virtual void _filterNews(std::vector<RsGxsNotify*>& changes);
};
*/
// **************** data classes **********************
// want to check if the file type is on a white list?
// http://en.wikipedia.org/wiki/List_of_file_signatures
// want to avoid disaster because of handing untrusted data to the browser
// svg scared me
// RsGxsImage is to complicated
// this class is much simpler, because the memory managment is hidden in a std::vector
class WallImage{
public:
std::vector<uint8_t> mData;
};
class WallGroup{
public:
RsGroupMetaData mMeta;
// in meta:
// mAuthorId (required)
// mCirlceId (optional)
std::string mProfileText;
WallImage mAvatarImage;
WallImage mWallImage;
};
class PostGroup{
public:
RsGroupMetaData mMeta;
// in meta:
// mAuthorId (optional)
// mCirlceId (optional)
// want to have a label to know type of content in PostGroup?
// could put a snippet of the content here
// this would allow to have it available without beeing subscribed
};
class ReferenceMsg{
public:
RsMsgMetaData mMeta;
// in meta:
// mAuthorId (optional)
RsGxsGroupId mReferencedGroup; // this can be a id of a PostGroup or WallGroup
// or even id of a photo album
// different use case for references:
// - share post on wall
// - like post
// - share wall
// - like wall
static const uint32_t REFTYPE_SHARE = 0;
static const uint32_t REFTYPE_COMMENT = 1;
uint32_t mType;
// idea:
// uint32_t mReferencedServiceType
// this would allow to link in posts from other gxs services
};
class PostMsg{
public:
RsMsgMetaData mMeta;
// in meta:
// mGroupId // when creating a new post msg, this represents the target wall id
// // when reading it is the correct parent grp id as usual
// mAuthorId (optional, but same as in PostGroup)
// want to allow different content for posts:
// - text
// - images
// - a web url
// - hash of a file
std::string mPostText;
//std::vector<Image> mImages; // gxs-msgs are limited in size, so maybe only one image
// (use photo albums for image sets)
// not in serialiser yet
//Image mImage;
//std::vector<RsGxsFile> mFiles; // FileMeta is hash + size + name + (some other meta maybe?)
};
/*
// *************** item classes ***********************
class WallGroupItem: public RsGxsGrpItem
{
public:
WallGroup mWallGroup;
}
class PostGroupItem: public RsGxsGrpItem
{
public:
PostGroup mPostGroup;
}
class ReferenceMsgItem: public RsGxsMsgItem
{
public:
ReferenceMsg mReferenceMsg;
}
class PostMsgItem: public RsGxsMsgItem
{
public:
PostMsg mPostMsg;
}
// also used:
// RsGxsCommentItem
// RsGxsVoteItem
// ************ end clean plan **********************
*/
// how to process incoming grps and msgs?
// grps
// check if grp id is in wanted grps list, then subscribe
// msgs
// check if referenced grp is subscribed or available
// if available: subscribe
// if not available: put into wanted grps list
// if a new post-grp was subscribed:
// make newsfeed entry
//
// have to track wall grp-ids
// have to track circles of friends
// wall-grps are easy to track, because they are of type wall-grp and have author id set
// can then derive friends groups from circle ids in wall grps
//
// how to maintain newsfeed?
// sort by time of arrival
// want to re-sort if new comments or votes arrive?
// make placeholder function to allow filtering of newsfeed entrys later
// problem: can't browse gxs-grp-content without subscribing to it
// rs is missing a load-on-demand function to browse content
// but can subscribe to group and subscribe and download only the latest post-grps
// group stores 365 days * 10 referenced posts/day * 500 bytes/referenced post
// = 1,8 megabytes
// this allows to subscribe to all interesting groups and then pick latest posts
// this would lead to not all posts available, just the posts at the time the site was interesting
// can live with this, if the site was really interesting neighbor users would subscribe and download all posts
// subscribe all posts if the user likes the site
// if i learn about 10 sites per day i have to download 18 megabytes per day
// assuming everyone has 400 kbit/s = 50 kbytes/s upstream
// then have to upload for 6mins
// this is ok, even if i have to do this 2-3 times it is ok
// dsl rates
// 1024/128
// 2048/192
// 6016/512
// if we store friendslist as a circle
// then we need to edit circles
// how can someone notice if he gets removed from a circle?
// impossible for self restricted circle, because he can't receive the circle anymore
// idea: add a list of to-be-removed-ids to the circle
// then first add to remove list and later remove from allowed list
// the last thing the removed one can see is its own name on the removed list
// this does not work, because the latest circle-info is used for permission check
// subcircles would allow to send msgs to friends + friends of friends
// future, if the complicated subcircle things is available
// how fof circle would work:
// everyone has a circle for friends
// and a circle for fof, which consists of subcricles which are the own and friends friends circles
// plan:
// wall -> gxs-group
// connected to a single identity, so this is a gxs-group with author
// msgs are just group-ids of posts
// these ids can even be cross-service ids
// this would allow to have all sort of content on the wall, like a link to a photo album
// but which service would handle the comments? the wall service?
// can have different groups:
// one for friends
// one for the public
// if i like something: publish it in wall grp
// if i share something, make msg with grp-id of content
// others can make msgs with grp-ids of content
// subscribe by friendship(automated) or follow
// who can post?
// public wall: everyone
// friends only wall: friends only. this is a implicit rule,
// because you have to see the gxs-grp to make posts in it
// don't need a publish sign, because posts are signed by author which is same as grp author in own wall-grp
// what about a profile?
// store basic profile info in grp item to have it available without subscribing?
// i can see comments/posts from fofs on my friends wall
// i have the fof wall grp item from my friends, but i'm not subscribed
// so if profile data is stored in grp, then i could see profile of fof
//
// site -> gxs-group
// msgs contain grp-ids of posts
// similar to wall
// not connected to a single identity
// a site is a public space
// subscribe by hand
// can't see content without subscribing
// two subscribe levels: auto subscribe to gxs-grps which could be interesting
// and have another user layer subscribe to let the user choose if it is interesting
// have also to subscribe to content-grps
// don't want to download all content just because it could be interesting -> problem
// what about author and publish sign?
//
// root post -> gxs-group
// gxs-group can have author, but it can't be signed by publish key of other gxs-grp
// would need a parent grp label which gets signed by parent grps publish key
// similar to identity system
// this would not be needed, if it was possible to sign single messages in a grp with the publish key
// then the root post msgs in the root post grp would be signed by publish
// so to verify if a gxs-grp as root post belongs to another grp we have check if it is referenced in this grp
// but then this has to be a grp with publish sign
// can also have a anon root post = anon gxs-grp
//
// gxs offers three auth/sign levels:
// public
// restricted
// private make this to require publish sign
// probably always want author sign
//
// about blocking unwanted content
// want to remove content from wall or pages
// can publish a signed delete msg
// good receivers should then unsubscribe from the gxs-grps hosting the content
// unsubscribed gxs-grps can be garbage collected at some time in the future
// notes:
// ------
// how does gxs reputation work? where does mPeerOpinion come from?
// probably from reputation service
// can delete gxs-group??? how does this work? there is no tombstone, so the group info will we received again?
// can't delete gxs-msg
// libretroshare has a tokenqueue: gxstokenqueue
// can get a token for own use from rsgenexchange
// cool, because this allows us to define own requests which consist of different requestst
// unused?: mSignFlags
// same #defines in rstokenservice.h and rsgxsdataaccess.cc
// RsGxsGroupId is made from a sha1 hash which is reduced to 16 bytes later
// this should be fixed to use full 20 sha1 bytes
// but this is not backwards compatible because of fixed-length serialisation format
// make a interface for rsMsgs based on token system?
// then not all msgs would have to stay in ram all time, but still have a not blocking load
// we could store msgs in gxs, and sync them between locations
// what is RsItem.clear() good for?
// is this ever used?
// gxs supports only event receiver
// the multiplexing is done at the gui level
// but what if there are different guis like one Qt and one Wt?
// about fb from b1
// profile page: visible for friends by default
// timeline: visible for friends, friends can post to it,
// can post to own timeline
// click "share" at content from others, to import into timeline
// what i shared is public visible
// comments: can comment every root post
// like: have a personal list of likes, can like every content including comments
// like on comments is juts for display at the comment
// fb page: one can create a page. this is a public place where you have the right to delete posts
// others can share and like the page
// very similar to a blog
//
// thoughts on rs: probably don't want to make a like public
// about likes
// store like in the liked gxs-group: have public likes
// store in own wall-grp: like can be private
// friends will know i liked something without being subscribed to the grp
// so freinds learn about new groups
// maybe combine both?
// always on own wall
// and if the user allows it make a public like
// public likes are good for the content creator, because he receives feedback
// he will then continue to make good content
// but can't prevent fake-likes
// likes in wall-grp would give a local but maybe higher quality view on the like situation
// with shared content: want to make reference at origin to the place where it got shared?
// of course only if the place is public
// more about the local view
// a local view is something where i only see content from friends or friends + fofs
// idea: local view for rating files
// can abuse the mOriginalMsgId to store file hash
// then can request all comments for a file
// big question: how to remove/hide posts???
// own posts? posts from others?
// can block entire identities. is it possible to make a blacklist of posts with publish key?
// next steps
// ui items for post and replies
// make listmodel for newsfeed and wall (will have similar model with different parameters)
// gen identity ui
// list identity ui, maybe make this first, because backends is there
// things to do on first start:
// create id
// create circle for friends with author id set
// how can we know if a circle is a friendslist or just a circle?
// can't know this, so have to keep circle id somewhere
// which name should the circle have?
// maybe need some hacks in the circle system?
// can abuse RsGroupMetaData.mServiceString to have a flag which shows "this is a friendslist"
// better don't make hack.
// better detect by circle group meta if this can be a friendslist
// it can be a friendslist, if author is set. can be own friendslist if own author id set
// on friends wall, filter circles by friends author id
// what if A makes a circle named "friends of B", everyone will believe it is friends of B
// display circles by athor id like: author -> circle name
// from which service can i steal items and serialiser?
// gxscommentitems look useful
// p3gxscommentservice has this complicated rating formula
// formula doesn not handle relations like friendship and follow
// how to request comments: GxsCommentTreeWidget::service_requestComments
// want to rate root posts only, display others ordered by time
// want avatars later, how to do this?
// maybe store it with the profile in a author-only group
// about rsitems:
// can't change these later, so design them carefully
// check if tlv items can be extended later
// but try to include all data we want before first release
// for the docs
// mechanisms in gxs
// define who can receive: circles
// verification:
// publish sign
// author sign
/*
WallItems
// root Posts
// group contains post itself an replys + votes
class WallPostGroup{
RsGroupMetaData mMeta;
}
class WallPost{
RsMsgMetaData mMeta;
std::string mMsg;
}
class WallVote{
RsMsgMetaData mMeta;
uint8_t mVote;
}
// group contains grpIds of grps where we contributed to
class WallPointerGroup{
RsGroupMetaData mMeta;
}
class WallPointer{
RsMsgMetaData mMeta;
uint8_t mType;
const uint8_t WPTR_TYPE_COMMENT = 0;
const uint8_t WPTR_TYPE_VOTE_UP = 1; // want to know if up or downvote
const uint8_t WPTR_TYPE_VOTE_DOWN = 2; // don't want to subscibe to downvoted groups
}
class WallProfileGroup{
RsGroupMetaData mMeta;
}
class WallProfileEntry{
// want to have profile data splitted into different msgs?
// this would allow cheap updating of single entrys
// this depends on size of msg meta
// msg meta has:
// 4x msg id with 20 bytes
// 1x grp id with 16 bytes
// 1x author id with 16 bytes
// 1x signatures, dont know how large measured for gxs forum post 322 bytes
// probably is the textual profile data not so big, so put all text in one item
// pictures are big, so one pic per entry item
// item header is 2x4=8 byte
// makes 120 + 322 + 8 = 450 bytes
// more important: what should be on profile page?
// look at other social networks
}
*/
class RsWallMsg{
public:
RsMsgMetaData mMeta;
std::string mMsg;
};
class RsWallGroup{
public:
RsGroupMetaData mMeta;
};
/*
message and group changes propagation:
what about group subscribe/unsubscribe events???
is it implemented to get these?
rsgenexchange calls
virtual void notifyChanges(std::vector<RsGxsNotify*>& changes) = 0;
have to implement this in own rsgenexchange derived class
then call
RsGxsIfaceHelper::receiveChanges(changes)
which then calls
void RsGenExchange::receiveChanges(std::vector<RsGxsNotify*>& changes)
why does this go through all layers and not directly?
rsgenexchange makes a list of this changes, and the it can be retrieved from gxsifacehelper,
whichs calls genexchange
next level is a class which polls gxsifacehelper, where widgets register to receive updates
gxsupdatebroadcast
*/
/*
class RsWall: public RsGxsIfaceHelper{
public:
virtual bool getGroupData(const uint32_t &token, std::vector<RsWallGroup> &groups) = 0;
virtual bool getMsgData(const uint32_t &token, std::vector<RsWallMsg> &msgs) = 0;
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0;
virtual bool createGroup(uint32_t &token, RsGxsForumGroup &group) = 0;
virtual bool createMsg(uint32_t &token, RsGxsForumMsg &msg) = 0;
// need to handle new msgs in groups
// need to handle new groups, and subscribe if required
// ui needs to receive new groups
// ui displays news in a list
// how to know size of list?
// want to use dynamic loading of data from listmodel
// maintain a list of group ids
// need to sort groups? to make interestig posts first?
// idea: have a list of all subscribed group ids, have to do this anyways
// then rank the ids by:
// last post
// how many friends commented
// likes of friends
};
*/
} // namespace RsWall