private static void checkMSG()
{
if (File.Exists("ack.txt"))
{
AckMessage.AddRange(File.ReadAllLines("ack.txt"));
}
cont = true;
while (cont)
{
lock (AckMessage)
{
for (int ii = 0; ii < AckMessage.Count; ii++)
{
string[] parts = AckMessage[ii].Split(new char[]{' '},2);
if (parts.Length > 1)
{
switch (BitAPIserver.BA.getStatus(parts[0]).ToLower().Trim())
{
case "notfound":
adminMsg("ERR: Error sending message.",
string.Format(@"Your Message '{0}' could not be sent.
Status: notfound
You probably tried to send a message to yourself or from an address that is not yours.
It is also possible, that you deleted the message from the outbox.", parts[1]));
AckMessage.RemoveAt(ii--);
break;
case "broadcastsent":
adminMsg("OK: Broadcast sent",
string.Format("Your broadcast '{0}' was sent", parts[1]));
AckMessage.RemoveAt(ii--);
break;
case "msgsent":
break;
case "ackreceived":
adminMsg("OK: Message sent",
string.Format("Your Message '{0}' was sent and reached its destination.", parts[1]));
AckMessage.RemoveAt(ii--);
break;
default:
break;
}
}
else
{
AckMessage.RemoveAt(ii--);
}
}
}
for (int i = 0; i < 30 && cont; i++)
{
Thread.Sleep(1000);
}
if (File.Exists("ack.txt"))
{
File.Delete("ack.txt");
}
if (AckMessage.Count > 0)
{
File.WriteAllLines("ack.txt", AckMessage.ToArray());
}
}
}