Compare commits
2 commits
5daad52aba
...
09d5bfef82
Author | SHA1 | Date | |
---|---|---|---|
09d5bfef82 | |||
d426df91f0 |
1 changed files with 16 additions and 30 deletions
|
@ -197,7 +197,7 @@ namespace SharpChat {
|
|||
hasChanged = true;
|
||||
}
|
||||
|
||||
if(colour.HasValue && user.Colour.Equals(colour.Value)) {
|
||||
if(colour.HasValue && !user.Colour.Equals(colour.Value)) {
|
||||
user.Colour = colour.Value;
|
||||
hasChanged = true;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ namespace SharpChat {
|
|||
hasChanged = true;
|
||||
}
|
||||
|
||||
if(isSuper.HasValue) {
|
||||
if(isSuper.HasValue && user.IsSuper != isSuper) {
|
||||
user.IsSuper = isSuper.Value;
|
||||
hasChanged = true;
|
||||
}
|
||||
|
@ -262,19 +262,12 @@ namespace SharpChat {
|
|||
|
||||
public void HandleChannelEventLog(string channelName, Action<ISockChatS2CPacket> handler) {
|
||||
foreach(ChatEventInfo info in EventStorage.GetChannelEventLog(channelName)) {
|
||||
ISockChatS2CPacket? packet;
|
||||
|
||||
switch(info.Type) {
|
||||
case "msg:add":
|
||||
string maText = string.Empty;
|
||||
bool maAction = false;
|
||||
if(info.Data is not MessageAddEventData msgAdd)
|
||||
break;
|
||||
|
||||
if(info.Data is MessageAddEventData messageAdd) {
|
||||
maText = messageAdd.Text;
|
||||
maAction = messageAdd.IsAction;
|
||||
}
|
||||
|
||||
packet = new MessageAddLogS2CPacket(
|
||||
handler(new MessageAddLogS2CPacket(
|
||||
info.Id,
|
||||
info.Created,
|
||||
info.SenderId,
|
||||
|
@ -282,54 +275,47 @@ namespace SharpChat {
|
|||
info.SenderColour,
|
||||
info.SenderRank,
|
||||
info.SenderPerms,
|
||||
maText,
|
||||
maAction,
|
||||
msgAdd.Text,
|
||||
msgAdd.IsAction,
|
||||
info.ChannelName.StartsWith('@'),
|
||||
info.IsBroadcast,
|
||||
false
|
||||
);
|
||||
));
|
||||
break;
|
||||
|
||||
case "user:connect":
|
||||
packet = new UserConnectLogS2CPacket(
|
||||
handler(new UserConnectLogS2CPacket(
|
||||
info.Id,
|
||||
info.Created,
|
||||
SockChatUtility.GetUserName(info)
|
||||
);
|
||||
));
|
||||
break;
|
||||
|
||||
case "user:disconnect":
|
||||
packet = new UserDisconnectLogS2CPacket(
|
||||
handler(new UserDisconnectLogS2CPacket(
|
||||
info.Id,
|
||||
info.Created,
|
||||
SockChatUtility.GetUserName(info),
|
||||
info.Data is UserDisconnectEventData userDisconnect ? userDisconnect.Reason : UserDisconnectReason.Leave
|
||||
);
|
||||
));
|
||||
break;
|
||||
|
||||
case "chan:join":
|
||||
packet = new UserChannelJoinLogS2CPacket(
|
||||
handler(new UserChannelJoinLogS2CPacket(
|
||||
info.Id,
|
||||
info.Created,
|
||||
SockChatUtility.GetUserName(info)
|
||||
);
|
||||
));
|
||||
break;
|
||||
|
||||
case "chan:leave":
|
||||
packet = new UserChannelLeaveLogS2CPacket(
|
||||
handler(new UserChannelLeaveLogS2CPacket(
|
||||
info.Id,
|
||||
info.Created,
|
||||
SockChatUtility.GetUserName(info)
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
packet = null;
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
||||
if(packet != null)
|
||||
handler(packet);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue