mirror of
https://github.com/deavminet/skippy.git
synced 2025-01-03 12:22:05 +00:00
Use unique tags, Tristanable clears tags later but the point was to use unique tags also for the factor the garbage collector deletes old ones that are complete but we cannot wait for that (after receiving it is not actively removed)
This commit is contained in:
parent
44ff9a06ad
commit
9c634c5c2e
@ -1,5 +1,4 @@
|
||||
import std.stdio;
|
||||
|
||||
import tristanable.manager;
|
||||
import std.socket;
|
||||
import client;
|
||||
@ -194,6 +193,8 @@ void configAutoJoin(string server)
|
||||
foreach(JSONValue value; config["servers"][server]["channels"].array())
|
||||
{
|
||||
string channel = value.str();
|
||||
//import core.thread;
|
||||
//Thread.getThis().sleep(dur!("seconds")(1));
|
||||
if(dclient.join(channel))
|
||||
{
|
||||
writeln("Already present in channel "~channel);
|
||||
|
@ -11,6 +11,8 @@ public class DClient
|
||||
*/
|
||||
private Manager manager;
|
||||
|
||||
|
||||
private long i = 20;
|
||||
this(Address address)
|
||||
{
|
||||
/* Initialize the socket */
|
||||
@ -38,10 +40,11 @@ public class DClient
|
||||
data ~= password;
|
||||
|
||||
/* Send the protocol data */
|
||||
manager.sendMessage(1, data);
|
||||
manager.sendMessage(i, data);
|
||||
|
||||
/* Receive the server's response */
|
||||
byte[] resp = manager.receiveMessage(1);
|
||||
byte[] resp = manager.receiveMessage(i);
|
||||
i++;
|
||||
|
||||
return cast(bool)resp[0];
|
||||
}
|
||||
@ -56,31 +59,36 @@ public class DClient
|
||||
data ~= channel;
|
||||
|
||||
/* Send the protocol data */
|
||||
manager.sendMessage(1, data);
|
||||
manager.sendMessage(i, data);
|
||||
|
||||
/* Receive the server's response */
|
||||
byte[] resp = manager.receiveMessage(1);
|
||||
byte[] resp = manager.receiveMessage(i);
|
||||
i++;
|
||||
|
||||
return cast(bool)resp[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string[] list()
|
||||
{
|
||||
//static ulong i = 50;
|
||||
string[] channels;
|
||||
|
||||
/* The protocol data to send */
|
||||
byte[] data = [6];
|
||||
|
||||
/* Send the protocol data */
|
||||
manager.sendMessage(1, data);
|
||||
manager.sendMessage(i, data);
|
||||
|
||||
/* Receive the server's response */
|
||||
byte[] resp = manager.receiveMessage(1);
|
||||
byte[] resp = manager.receiveMessage(i);
|
||||
|
||||
string channelList = cast(string)resp[1..resp.length];
|
||||
channels = split(channelList, ",");
|
||||
|
||||
/* TODO: Throw error on resp[0] zero */
|
||||
i++;
|
||||
|
||||
return channels;
|
||||
}
|
||||
@ -123,11 +131,11 @@ public class DClient
|
||||
protocolData ~= cast(byte[])message;
|
||||
|
||||
/* Send the protocol data */
|
||||
manager.sendMessage(1, protocolData);
|
||||
manager.sendMessage(i, protocolData);
|
||||
|
||||
/* Receive the server's response */
|
||||
byte[] resp = manager.receiveMessage(1);
|
||||
|
||||
byte[] resp = manager.receiveMessage(i);
|
||||
i++;
|
||||
return cast(bool)resp[0];
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,8 @@ public class NotificationWatcher : Thread
|
||||
}
|
||||
}
|
||||
|
||||
writeln("bababbaba");
|
||||
|
||||
Thread.getThis().sleep(dur!("seconds")(2));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user