Skip to content

Commit

Permalink
Hooked up AccountData from the events when syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
VRocker committed Apr 27, 2019
1 parent 059ce7e commit 981b030
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Events/AccountData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using libMatrix.Responses;
using System;

namespace libMatrix
{
public partial class Events
{
public class AccountDataEventArgs : EventArgs
{
public MatrixEvents Event;
}

public delegate void AccountDataDelegate(object sender, AccountDataEventArgs e);

public event AccountDataDelegate AccountDataEvent;

internal void FireAccountDataEvent(MatrixEvents evt) => AccountDataEvent?.Invoke(this, new AccountDataEventArgs() { Event = evt });
}
}
9 changes: 9 additions & 0 deletions MatrixParsers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ private async Task ParseClientSync(string resp)
}
}

if (response.AccountData != null)
{
foreach (var evt in response.AccountData.Events)
{
Debug.WriteLine("AccountData Event: " + evt.Type);
_events.FireAccountDataEvent(evt);
}
}

// Do stuff
IsConnected = true;
}
Expand Down
2 changes: 2 additions & 0 deletions libMatrix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
<Compile Include="Backends\IMatrixAPIBackend.cs" />
<Compile Include="Backends\MatrixErrorCode.cs" />
<Compile Include="Backends\MatrixRequestError.cs" />
<Compile Include="Events\AccountData.cs" />
<Compile Include="Events\Error.cs" />
<Compile Include="Events\LogInOut.cs" />
<Compile Include="Events\Rooms.cs" />
Expand All @@ -124,6 +125,7 @@
<Compile Include="MatrixSyncThread.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Requests\Presence\MatrixSetPresence.cs" />
<Compile Include="Requests\Rooms\MatrixRoomCreate.cs" />
<Compile Include="Requests\Rooms\MatrixRoomInvite.cs" />
<Compile Include="Requests\Rooms\MatrixRoomJoin.cs" />
<Compile Include="Requests\Rooms\MatrixRoomSendTyping.cs" />
Expand Down

0 comments on commit 981b030

Please sign in to comment.