Remove unused UnsignedEventData class
It is now implemented in Matrix.Event.Room
This commit is contained in:
parent
4a86522b72
commit
9be25a5d61
@ -542,80 +542,6 @@ namespace Matrix {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Class to hold unsigned event data, like event age, redact
|
|
||||||
* reason or a transaction ID.
|
|
||||||
*/
|
|
||||||
public class UnsignedEventData : JsonCompact {
|
|
||||||
/**
|
|
||||||
* The age of the event, in seconds.
|
|
||||||
*/
|
|
||||||
public uint age { get; set; default = 0; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The reason of redaction, if any.
|
|
||||||
*/
|
|
||||||
public string? redact_reason { get; set; default = null; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The transaction ID of the message.
|
|
||||||
*/
|
|
||||||
public string? transaction_id { get; set; default = null; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an UnsignedEventData object based
|
|
||||||
* on @param json_data.
|
|
||||||
*/
|
|
||||||
public
|
|
||||||
UnsignedEventData.from_json(Json.Node json_data)
|
|
||||||
requires(json_data.get_node_type() == Json.NodeType.OBJECT)
|
|
||||||
{
|
|
||||||
var root = json_data.get_object();
|
|
||||||
Json.Node node;
|
|
||||||
|
|
||||||
if ((node = root.get_member("age")) != null) {
|
|
||||||
age = (uint)node.get_int();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((node = root.get_member("redacted_because")) != null) {
|
|
||||||
redact_reason = node.get_string();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((node = root.get_member("transaction_id")) != null) {
|
|
||||||
transaction_id = node.get_string();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the unsigned event data as a JSON node.
|
|
||||||
*/
|
|
||||||
public override Json.Node?
|
|
||||||
get_json_node()
|
|
||||||
throws Matrix.Error
|
|
||||||
{
|
|
||||||
var builder = new Json.Builder();
|
|
||||||
|
|
||||||
builder.begin_object();
|
|
||||||
|
|
||||||
builder.set_member_name("age");
|
|
||||||
builder.add_int_value(age);
|
|
||||||
|
|
||||||
if (redact_reason != null) {
|
|
||||||
builder.set_member_name("redacted_because");
|
|
||||||
builder.add_string_value(redact_reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transaction_id != null) {
|
|
||||||
builder.set_member_name("transaction_id");
|
|
||||||
builder.add_string_value(transaction_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.end_object();
|
|
||||||
|
|
||||||
return builder.get_root();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class EventContext : JsonCompact {
|
public class EventContext : JsonCompact {
|
||||||
public int? before_limit { get; set; default = null; }
|
public int? before_limit { get; set; default = null; }
|
||||||
public int? after_limit { get; set; default = null; }
|
public int? after_limit { get; set; default = null; }
|
||||||
|
Loading…
Reference in New Issue
Block a user