Exemplo n.º 1
0
 private static void msgListen()
 {
     cont = true;
     while (cont)
     {
         BitMsg[] Messages = JsonConverter.getMessages(BA.getAllInboxMessages());
         foreach (BitMsg m in Messages)
         {
             if (m.message.StartsWith("GET ") || m.message.StartsWith("POST "))
             {
                 string[] Parts = m.message.Split(new string[] { "\r\n\r\n" }, 2, StringSplitOptions.None);
                 //Decode content, if present
                 byte[] content = null;
                 if (Parts.Length == 2 && Parts[1].Length > 0)
                 {
                     Ascii85 A5 = new Ascii85();
                     content = A5.Decode(Parts[1]);
                 }
                 Thread t = new Thread(new ParameterizedThreadStart(sr));
                 t.IsBackground = true;
                 t.Start(new object[] { m.fromAddress, m.toAddress, m.subject, Parts[0], content });
                 BA.trashMessage(m.msgid);
             }
         }
         Thread.Sleep(2000);
     }
 }
Exemplo n.º 2
0
 private static void msgListen()
 {
     while (s != null)
     {
         BitMsg[] Messages = JsonConverter.getMessages(BA.getAllInboxMessages());
         foreach (BitMsg m in Messages)
         {
             if (Req.ContainsKey(m.subject) && m.message.StartsWith("HTTP"))
             {
                 string[] Parts = m.message.Split(new string[] { "\r\n\r\n" }, 2, StringSplitOptions.None);
                 if (Parts.Length == 2)
                 {
                     //Decode content, if present
                     byte[] content = null;
                     if (Parts[1].Length > 0)
                     {
                         Ascii85 A5 = new Ascii85();
                         content = A5.Decode(Parts[1]);
                     }
                     BA.trashMessage(m.msgid);
                     Req[m.subject].Send(Parts[0], content);
                     //Remove connection and request
                     cc.Remove(Req[m.subject]);
                     Req.Remove(m.subject);
                 }
             }
         }
         Thread.Sleep(2000);
     }
 }
Exemplo n.º 3
0
 public void DeleteMessage(GenericMessage MSG)
 {
     BA.trashMessage(MSG.Tag.ToString());
 }