This repository has been archived by the owner on Jan 29, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic XEP-0313: Message Archive Management support #139
- Loading branch information
Showing
14 changed files
with
484 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
XMPP_API/Classes/Network/XML/Messages/Helper/MessageResponseHelperResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
using System.Xml; | ||
using Logging; | ||
|
||
namespace XMPP_API.Classes.Network.XML.Messages.XEP_0059 | ||
{ | ||
public class Set | ||
{ | ||
//--------------------------------------------------------Attributes:-----------------------------------------------------------------\\ | ||
#region --Attributes-- | ||
public readonly string AFTER; | ||
public readonly string BEFORE; | ||
public readonly uint? COUNT; | ||
public readonly string FIRST; | ||
public readonly uint? FIRST_INDEX; | ||
public readonly uint? INDEX; | ||
public readonly string LAST; | ||
public readonly string MAX; | ||
|
||
#endregion | ||
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ | ||
#region --Constructors-- | ||
public Set(XmlNode answer) | ||
{ | ||
XmlNode afterNode = XMLUtils.getChildNode(answer, "after"); | ||
if (!(afterNode is null)) | ||
{ | ||
AFTER = afterNode.InnerText; | ||
} | ||
|
||
XmlNode beforeNode = XMLUtils.getChildNode(answer, "before"); | ||
if (!(beforeNode is null)) | ||
{ | ||
BEFORE = beforeNode.InnerText; | ||
} | ||
|
||
XmlNode countNode = XMLUtils.getChildNode(answer, "count"); | ||
if (!(countNode is null)) | ||
{ | ||
if (uint.TryParse(countNode.InnerText, out uint count)) | ||
{ | ||
COUNT = count; | ||
} | ||
else | ||
{ | ||
Logger.Error("Failed to parse XEP-0313 SET count node value as uint: " + countNode.InnerText); | ||
} | ||
} | ||
|
||
XmlNode firstNode = XMLUtils.getChildNode(answer, "first"); | ||
if (!(firstNode is null)) | ||
{ | ||
FIRST = firstNode.InnerText; | ||
string tmp = firstNode.Attributes["index"]?.Value; | ||
if (!(tmp is null)) | ||
{ | ||
if (uint.TryParse(tmp, out uint index)) | ||
{ | ||
FIRST_INDEX = index; | ||
} | ||
else | ||
{ | ||
Logger.Error("Failed to parse XEP-0313 SET first_index node value as uint: " + tmp); | ||
} | ||
} | ||
} | ||
|
||
XmlNode indexNode = XMLUtils.getChildNode(answer, "index"); | ||
if (!(indexNode is null)) | ||
{ | ||
if (uint.TryParse(indexNode.InnerText, out uint index)) | ||
{ | ||
INDEX = index; | ||
} | ||
else | ||
{ | ||
Logger.Error("Failed to parse XEP-0313 SET index node value as uint: " + indexNode.InnerText); | ||
} | ||
} | ||
|
||
XmlNode lastNode = XMLUtils.getChildNode(answer, "last"); | ||
if (!(lastNode is null)) | ||
{ | ||
LAST = lastNode.InnerText; | ||
} | ||
|
||
XmlNode maxNode = XMLUtils.getChildNode(answer, "max"); | ||
if (!(maxNode is null)) | ||
{ | ||
MAX = maxNode.InnerText; | ||
} | ||
} | ||
|
||
#endregion | ||
//--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\ | ||
#region --Set-, Get- Methods-- | ||
|
||
|
||
#endregion | ||
//--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\ | ||
#region --Misc Methods (Public)-- | ||
|
||
|
||
#endregion | ||
|
||
#region --Misc Methods (Private)-- | ||
|
||
|
||
#endregion | ||
|
||
#region --Misc Methods (Protected)-- | ||
|
||
|
||
#endregion | ||
//--------------------------------------------------------Events:---------------------------------------------------------------------\\ | ||
#region --Events-- | ||
|
||
|
||
#endregion | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
XMPP_API/Classes/Network/XML/Messages/XEP-0313/MamResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
|
||
namespace XMPP_API.Classes.Network.XML.Messages.XEP_0313 | ||
{ | ||
public class MamResult | ||
{ | ||
//--------------------------------------------------------Attributes:-----------------------------------------------------------------\\ | ||
#region --Attributes-- | ||
public readonly string FIRST; | ||
public readonly string LAST; | ||
public readonly uint INDEX; | ||
public readonly uint COUNT; | ||
public readonly bool COMPLETE; | ||
public readonly List<QueryArchiveResultMessage> RESULTS; | ||
|
||
#endregion | ||
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ | ||
#region --Constructors-- | ||
public MamResult(QueryArchiveFinishMessage msg, List<QueryArchiveResultMessage> results) | ||
{ | ||
if (!msg.COMPLETE) | ||
{ | ||
Debug.Assert(string.IsNullOrEmpty(msg.RESULT_SET.FIRST)); | ||
Debug.Assert(!(msg.RESULT_SET.FIRST_INDEX is null)); | ||
Debug.Assert(string.IsNullOrEmpty(msg.RESULT_SET.LAST)); | ||
|
||
FIRST = msg.RESULT_SET.FIRST; | ||
LAST = msg.RESULT_SET.LAST; | ||
INDEX = (uint)msg.RESULT_SET.FIRST_INDEX; | ||
} | ||
else | ||
{ | ||
COMPLETE = true; | ||
} | ||
Debug.Assert(!(msg.RESULT_SET.COUNT is null)); | ||
COUNT = (uint)msg.RESULT_SET.COUNT; | ||
|
||
RESULTS = results; | ||
} | ||
|
||
#endregion | ||
//--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\ | ||
#region --Set-, Get- Methods-- | ||
|
||
|
||
#endregion | ||
//--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\ | ||
#region --Misc Methods (Public)-- | ||
|
||
|
||
#endregion | ||
|
||
#region --Misc Methods (Private)-- | ||
|
||
|
||
#endregion | ||
|
||
#region --Misc Methods (Protected)-- | ||
|
||
|
||
#endregion | ||
//--------------------------------------------------------Events:---------------------------------------------------------------------\\ | ||
#region --Events-- | ||
|
||
|
||
#endregion | ||
} | ||
} |
Oops, something went wrong.