/*public static Packet Create(DataMap map, object target, int sourceId, bool isName) * { * try * { * if (isName) * { * Static.RequestedGroups.Add(new RequestGroup * { * Name = (string)target, * SourceId = sourceId, * IsName = true * }); * } * else * { * Static.RequestedGroups.Add(new RequestGroup * { * TargetId = (int)target, * SourceId = sourceId, * IsName = false * }); * } * } * catch (Exception) * { * } * return new Packet("PROVIF QUERY") * { * Headers = { { "mesg-id", "34163" }, { "last", "1" } }, * Payload = Encoding.GetEncoding("windows-1252").GetString(map.Serialize()) * }; * } * * public static Packet Create(DataMap map, object target, int sourceId) * { * bool isName = false; * try * { * if (isName) * { * Static.RequestedGroups.Add(new RequestGroup * { * Name = (string)target, * SourceId = sourceId, * IsName = true * }); * } * else * { * Static.RequestedGroups.Add(new RequestGroup * { * TargetId = (int)target, * SourceId = sourceId, * IsName = false * }); * } * } * catch (Exception) * { * } * return new Packet("PROVIF QUERY") * { * Headers = { { "mesg-id", "34163" }, { "last", "1" } }, * Payload = Encoding.GetEncoding("windows-1252").GetString(map.Serialize()) * }; * } * * public static Packet QueryGroup(string name, int targetGroup) * { * var search = new GroupSearch(1, true); * search.AddGroupNameFilter(name, true); * var datamap = search.ConstructDataMap(); * return Create(datamap, name, targetGroup, true); * } * * public static Packet QueryGroup(int id, int targetGroup) * { * var search = new GroupSearch(1, true); * search.AddGroupIDCriteria((ulong)id); * var datamap = search.ConstructDataMap(); * return Create(datamap, id, targetGroup); * } * * public static Packet QueryGroup(int id) * { * return QueryGroup(id, -1); * } * * public static Packet QueryGroup(string name) * { * return QueryGroup(name, -1); * }*/ #endregion #region Queries public static Packet FetchUserAvatar(int userId) { var packet = new Packet("AVATAR"); packet.AddHeader("id", userId.ToString()); packet.AddHeader("MESG-id", LastMessageID++.ToString()); packet.AddHeader("size", "2000"); return(packet); }
public static Packet FetchGroupAvatar(int groupId) { var packet = new Packet("AVATAR"); packet.AddHeader("group", "T"); packet.AddHeader("id", groupId.ToString()); packet.AddHeader("MESG-id", LastMessageID++.ToString()); packet.AddHeader("size", "2000"); return(packet); }
public static Packet FetchGroupAvatar(int groupId) { var packet = new Packet("AVATAR"); packet.AddHeader("group", "T"); packet.AddHeader("id", groupId.ToString()); packet.AddHeader("MESG-id", LastMessageID++.ToString()); packet.AddHeader("size", "2000"); return packet; }
/*public static Packet Create(DataMap map, object target, int sourceId, bool isName) { try { if (isName) { Static.RequestedGroups.Add(new RequestGroup { Name = (string)target, SourceId = sourceId, IsName = true }); } else { Static.RequestedGroups.Add(new RequestGroup { TargetId = (int)target, SourceId = sourceId, IsName = false }); } } catch (Exception) { } return new Packet("PROVIF QUERY") { Headers = { { "mesg-id", "34163" }, { "last", "1" } }, Payload = Encoding.GetEncoding("windows-1252").GetString(map.Serialize()) }; } public static Packet Create(DataMap map, object target, int sourceId) { bool isName = false; try { if (isName) { Static.RequestedGroups.Add(new RequestGroup { Name = (string)target, SourceId = sourceId, IsName = true }); } else { Static.RequestedGroups.Add(new RequestGroup { TargetId = (int)target, SourceId = sourceId, IsName = false }); } } catch (Exception) { } return new Packet("PROVIF QUERY") { Headers = { { "mesg-id", "34163" }, { "last", "1" } }, Payload = Encoding.GetEncoding("windows-1252").GetString(map.Serialize()) }; } public static Packet QueryGroup(string name, int targetGroup) { var search = new GroupSearch(1, true); search.AddGroupNameFilter(name, true); var datamap = search.ConstructDataMap(); return Create(datamap, name, targetGroup, true); } public static Packet QueryGroup(int id, int targetGroup) { var search = new GroupSearch(1, true); search.AddGroupIDCriteria((ulong)id); var datamap = search.ConstructDataMap(); return Create(datamap, id, targetGroup); } public static Packet QueryGroup(int id) { return QueryGroup(id, -1); } public static Packet QueryGroup(string name) { return QueryGroup(name, -1); }*/ #endregion #region Queries public static Packet FetchUserAvatar(int userId) { var packet = new Packet("AVATAR"); packet.AddHeader("id", userId.ToString()); packet.AddHeader("MESG-id", LastMessageID++.ToString()); packet.AddHeader("size", "2000"); return packet; }