allow joining by snowflake

This commit is contained in:
2019-07-20 13:03:45 +02:00
parent d86a386edd
commit f51e371f23
3 changed files with 35 additions and 13 deletions

View File

@@ -76,6 +76,8 @@ dc_account_t dc_session_account_fullname(dc_session_t s, char const *f);
*/
void dc_session_add_channel(dc_session_t s, dc_channel_t u);
dc_channel_t dc_session_channel_by_id(dc_session_t s, char const *snowflake);
/**
* Creates a new channel, or returns an existing channel if a channel with
* these recipients already exists.

View File

@@ -346,6 +346,12 @@ dc_account_t dc_session_account_fullname(dc_session_t s, char const *f)
return NULL;
}
dc_channel_t dc_session_channel_by_id(dc_session_t s, char const *snowflake)
{
return_if_true(s == NULL || snowflake == NULL, NULL);
return (dc_channel_t)g_hash_table_lookup(s->channels, snowflake);
}
void dc_session_add_channel(dc_session_t s, dc_channel_t u)
{
return_if_true(s == NULL || u == NULL,);