mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 22:45:12 +00:00
[ADD] Bare JIDs, use room nicks
This commit is contained in:
parent
fbf169a080
commit
e21785afcb
8 changed files with 151 additions and 16 deletions
30
src/AS.c
30
src/AS.c
|
|
@ -326,6 +326,7 @@ ASGetName(const ParseeConfig *c, char *room, char *user)
|
|||
HttpClientContext *ctx;
|
||||
HashMap *reply;
|
||||
char *path, *ret;
|
||||
char *u2 = user;
|
||||
if (!c || !user)
|
||||
{
|
||||
return NULL;
|
||||
|
|
@ -354,12 +355,37 @@ ASGetName(const ParseeConfig *c, char *room, char *user)
|
|||
|
||||
if (!ret)
|
||||
{
|
||||
ret = StrDuplicate(user);
|
||||
ret = StrDuplicate(u2);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
user = HttpUrlEncode(user);
|
||||
room = HttpUrlEncode(room);
|
||||
path = StrConcat(4,
|
||||
"/_matrix/client/v3/rooms/", room,
|
||||
"/state/m.room.member/", user
|
||||
);
|
||||
ctx = ParseeCreateRequest(c, HTTP_GET, path);
|
||||
Free(user);
|
||||
Free(room);
|
||||
ASAuthenticateRequest(c, ctx);
|
||||
HttpRequestSendHeaders(ctx);
|
||||
HttpRequestSend(ctx);
|
||||
|
||||
return NULL;
|
||||
reply = JsonDecode(HttpClientStream(ctx));
|
||||
|
||||
ret = StrDuplicate(
|
||||
JsonValueAsString(HashMapGet(reply, "displayname"))
|
||||
);
|
||||
HttpClientContextFree(ctx);
|
||||
JsonFree(reply);
|
||||
Free(path);
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
ret = StrDuplicate(u2);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
char *
|
||||
ASUpload(const ParseeConfig *c, Stream *from, unsigned int size)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue