mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:25:11 +00:00
[MOD/WIP] Start getting into intents
This commit is contained in:
parent
31305cdb23
commit
de8fd53a6f
4 changed files with 43 additions and 40 deletions
|
|
@ -174,7 +174,10 @@ GetXMPPInformation(ParseeData *data, HashMap *event, char **from, char **to)
|
|||
|
||||
chat_id = ParseeGetFromRoomID(data, room_id);
|
||||
|
||||
room_data = DbLock(data->db, 3, "rooms", room_id, "data");
|
||||
room_data = DbLockIntent(data->db,
|
||||
DB_HINT_READONLY,
|
||||
3, "rooms", room_id, "data"
|
||||
);
|
||||
data_json = DbJson(room_data);
|
||||
direct = GrabBoolean(data_json, 1, "is_direct");
|
||||
type = direct ? "chat" : "groupchat";
|
||||
|
|
@ -259,17 +262,16 @@ ParseeMessageHandler(ParseeData *data, HashMap *event)
|
|||
/* TODO: This ref should be marked as read-only,
|
||||
* as LMDB doesn't seem to like having two concurrent RW
|
||||
* transactions running. */
|
||||
ref = DbLock(data->db, 3, "rooms", id, "data");
|
||||
json = JsonDuplicate(DbJson(ref));
|
||||
ref = DbLockIntent(data->db, DB_HINT_READONLY, 3, "rooms", id, "data");
|
||||
json = DbJson(ref);
|
||||
direct = JsonValueAsBoolean(HashMapGet(json, "is_direct"));
|
||||
DbUnlock(data->db, ref);
|
||||
ref = NULL;
|
||||
|
||||
if (!direct && !chat_id)
|
||||
{
|
||||
ParseeBotHandler(data, event);
|
||||
|
||||
JsonFree(json);
|
||||
DbUnlock(data->db, ref);
|
||||
ref = NULL;
|
||||
Free(chat_id);
|
||||
Free(reply_id);
|
||||
Free(xepd);
|
||||
|
|
@ -365,7 +367,8 @@ end:
|
|||
Free(unauth);
|
||||
Free(unedited_id);
|
||||
|
||||
JsonFree(json);
|
||||
DbUnlock(data->db, ref);
|
||||
ref = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue