/// <summary>
 /// Creates an UpdateAvatar packet stream
 /// </summary>
 /// <param name="avatar"></param>
 /// <returns></returns>
 public static Packet[] UpdateAvatar(byte[] avatar)
 {
     return(PacketChunkanizer.Chunk(new Packet
     {
         Command = "ICON",
         Headers = new Dictionary <string, string>(),
         Payload = ""
     }, Static.PalringoEncoding.GetString(avatar)));
 }
Beispiel #2
0
 /// <summary>
 /// Packages up the data
 /// </summary>
 /// <param name="mesgtype"></param>
 /// <param name="dataType"></param>
 /// <param name="id"></param>
 /// <param name="data"></param>
 /// <returns></returns>
 public static Packet[] Package(MessageType mesgtype, DataType dataType, int id, string data)
 {
     return(PacketChunkanizer.Chunk(new Packet
     {
         Command = "MESG",
         Headers = new Dictionary <string, string>
         {
             ["Target-Id"] = id.ToString(),
             ["Mesg-Target"] = ((int)mesgtype).ToString(),
             ["Content-Type"] = dataType.FromDataType()
         }
     }, data));
 }
Beispiel #3
0
 /// <summary>
 /// Writes a packet to the TCP stream
 /// [[EXPERIMENTAL! USE EXISTING PACKET WRITERS IF THEY EXIST]]
 /// </summary>
 /// <param name="packet">The packet to write</param>
 /// <param name="onResponse">The optional response</param>
 public void WritePacket(Packet packet, rs onResponse = null)
 {
     _client.WritePackets(PacketChunkanizer.Chunk(packet).Watch(this, onResponse));
 }
Beispiel #4
0
 /// <summary>
 /// Requests a user add you as a contact.
 /// </summary>
 /// <param name="userid">The person's id</param>
 /// <param name="onResp">What to do when it happens.</param>
 public void AddContact(UserId userid, rs onResp = null)
 {
     _client.WritePackets(PacketChunkanizer.Chunk(PacketTemplates.AddContact(userid)).Watch(this, onResp));
 }
Beispiel #5
0
 /// <summary>
 /// Updates the basic profile of the user
 /// </summary>
 /// <param name="nickname">The nickname of the user</param>
 /// <param name="status">The status of the user</param>
 /// <param name="onResp">What to do on completion</param>
 public void UpdateBasicProfile(string nickname, string status, rs onResp = null)
 {
     this.Information.Profile.Nickname = nickname;
     this.Information.Profile.Status   = status;
     _client.WritePackets(PacketChunkanizer.Chunk(PacketTemplates.UpdateInfo(this.Information.Profile.Nickname, this.Information.Profile.Status)).Watch(this, onResp));
 }
Beispiel #6
0
 /// <summary>
 /// Updates the extended profile of the user.
 /// </summary>
 /// <param name="onResp">What to do on the requests completion.</param>
 public void UpdateExtendedProfile(rs onResp = null)
 {
     _client.WritePackets(PacketChunkanizer.Chunk(PacketTemplates.SubProfileUpdate(this.Information.Profile)).Watch(this, onResp));
 }