mirror of
https://github.com/deavminet/skippy.git
synced 2025-01-05 21:39:49 +00:00
Print out leave and join channel notifications
This commit is contained in:
parent
00913f394b
commit
9ee6117d84
@ -3,6 +3,7 @@ import tristanable.manager;
|
||||
import tristanable.notifications;
|
||||
import std.stdio;
|
||||
import core.time : dur;
|
||||
import tristanable.encoding;
|
||||
|
||||
public class NotificationWatcher : Thread
|
||||
{
|
||||
@ -52,11 +53,39 @@ public class NotificationWatcher : Thread
|
||||
/* TODO: Check notification type */
|
||||
byte notificationType = data[0];
|
||||
|
||||
/* Channel notification (ntype=1) */
|
||||
if(notificationType == cast(byte)1)
|
||||
/* For normal message (to channel or user) */
|
||||
if(notificationType == cast(byte)0)
|
||||
{
|
||||
/* TODO: Decode using tristanable */
|
||||
writeln("new message");
|
||||
}
|
||||
/* Channel notification (ntype=1) */
|
||||
else if(notificationType == cast(byte)1)
|
||||
{
|
||||
/* TODO: Decode using tristanable */
|
||||
/* TODO: Get the username of the user that left */
|
||||
writeln("user left");
|
||||
writeln("user left/join message");
|
||||
|
||||
/* Get the sub-type */
|
||||
byte subType = data[1];
|
||||
|
||||
/* If the notification was leave (stype=0) */
|
||||
if(subType == cast(byte)0)
|
||||
{
|
||||
string username = cast(string)data[2..data.length];
|
||||
writeln("<-- "~username~" left the channel");
|
||||
}
|
||||
/* If the notification was join (stype=1) */
|
||||
else if(subType == cast(byte)1)
|
||||
{
|
||||
string username = cast(string)data[2..data.length];
|
||||
writeln("--> "~username~" joined the channel");
|
||||
}
|
||||
/* TODO: Unknown */
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user