Skip to content

Commit 7b64ec3

Browse files
authored
emulate option type for replies in writes DB (#8)
1 parent 8d6ce94 commit 7b64ec3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

heffalump.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,15 @@ UInt16 SaturatingDecrement(UInt16 base) {
8181
return base == 0 ? base : base - 1;
8282
}
8383

84-
static TootContent* TootContentConstructor(UInt16 length) {
84+
static TootContent* TootContentConstructor(UInt16 length, UInt16* is_reply_to) {
8585
int size = sizeof(TootContent) + length + sizeof(char);
8686
TootContent* ret = (TootContent*) MemPtrNew(size);
8787
MemSet(ret, size, 0);
88+
if (is_reply_to != NULL) {
89+
// adding +1 here to emulate an option type.
90+
// this is subtracted again in the conduit
91+
ret->is_reply_to = *is_reply_to + 1;
92+
}
8893
ret->content_len = length;
8994
return ret;
9095
}
@@ -672,7 +677,8 @@ static Boolean ComposeTootFormHandleEvent(EventType* event) {
672677
MemHandle content_handle = FldGetTextHandle(content);
673678
FldSetTextHandle(content, NULL);
674679
char* content_str = (char*) MemHandleLock(content_handle);
675-
TootContent* to_write = TootContentConstructor(StrLen(content_str));
680+
UInt16* is_reply_to = sharedVarsP->toot_is_reply_to_current ? &(sharedVarsP->current_toot_author_record) : NULL;
681+
TootContent* to_write = TootContentConstructor(StrLen(content_str), is_reply_to);
676682
#ifdef HEFFALUMP_TESTING
677683
ErrNonFatalDisplayIf(StrLen(content_str) == 0, "Composed toot has zero len");
678684
#endif

0 commit comments

Comments
 (0)