diff --git a/EXAMPLES.md b/EXAMPLES.md
index 517c79f..22d3cc2 100644
--- a/EXAMPLES.md
+++ b/EXAMPLES.md
@@ -123,7 +123,7 @@ await client.SendMessageAsync(chats.chats[chatId], "Hello, World");
```
Notes:
- This list does not include discussions with other users. For this, you need to use [Messages_GetAllDialogs](#list-dialogs).
-- The list returned by Messages_GetAllChats contains the `access_hash` for those chats. Read [FAQ #4](FAQ.MD#access-hash) about this.
+- The list returned by Messages_GetAllChats contains the `access_hash` for those chats. Read [FAQ #4](FAQ.md#access-hash) about this.
- If a basic chat group has been migrated to a supergroup, you may find both the old `Chat` and a `Channel` with different IDs in the `chats.chats` result,
but the old `Chat` will be marked with flag [deactivated] and should not be used anymore. See [Terminology in ReadMe](README.md#terminology).
- You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs)
@@ -217,12 +217,23 @@ var participants = await client.Channels_GetAllParticipants(channel);
```
-### Join a channel/group by @channelname
+### Join a channel/group by their public name or invite link
+* For a public channel/group `@channelname`
+If you have a link of the form `https://t.me/channelname`, you need to extract the `channelname` from the URL.
+You can resolve the channel/group username and join it like this:
```csharp
var resolved = await client.Contacts_ResolveUsername("channelname"); // without the @
if (resolved.Chat is Channel channel)
await client.Channels_JoinChannel(channel);
```
+* For a private channel/group/chat, you need to have an invite link
+Telegram invite links can typically have two forms: `https://t․me/joinchat/HASH` or `https://t․me/+HASH` *(note the '+' prefix here)*
+To use them, you need to extract the `HASH` part from the URL and then you can use those two methods:
+```csharp
+var chatInvite = await client.Messages_CheckChatInvite("HASH"); // optional: get information before joining
+await client.Messages_ImportChatInvite("HASH"); // join the channel/group
+// Note: This works also with invite links of public channel/group
+```
### Add/Invite/Remove someone in a chat
diff --git a/FAQ.md b/FAQ.md
index 371e88b..b42ca53 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -82,7 +82,7 @@ After that, you should be able to see/install the pre-release versions in your N
This happens when you connect to Telegram Test servers instead of Production servers.
On these separate test servers, all created accounts and chats are periodically deleted, so you shouldn't use them under normal circumstances.
-You can verify this is your issue by looking at [WTelegram logs](EXAMPLES.MD#logging) on the line `Connected to (Test) DC x...`
+You can verify this is your issue by looking at [WTelegram logs](EXAMPLES.md#logging) on the line `Connected to (Test) DC x...`
This wrong-server problem typically happens when you use WTelegramClient Github source project in your application in DEBUG builds.
It is **not recommended** to use WTelegramClient in source code form.
diff --git a/src/Session.cs b/src/Session.cs
index 8b7a2c7..09d5a61 100644
--- a/src/Session.cs
+++ b/src/Session.cs
@@ -42,7 +42,9 @@ namespace WTelegram
if (msgIds == null)
{
msgIds = new long[msgIdsN];
- for (int i = 0; i < msgIdsN; i++) msgIds[i] = msg_id;
+ msgIds[0] = msg_id;
+ msg_id -= 300L << 32; // until the array is filled with real values, allow ids up to 300 seconds in the past
+ for (int i = 1; i < msgIdsN; i++) msgIds[i] = msg_id;
return true;
}
int newHead = (msgIdsHead + 1) % msgIdsN;