Added migration to update event types of older messages.
This commit is contained in:
parent
a6569815af
commit
795a87fe56
2 changed files with 9 additions and 5 deletions
|
@ -30,6 +30,15 @@ namespace SharpChat.EventStorage {
|
||||||
|
|
||||||
DoMigration("create_events_table", CreateEventsTable);
|
DoMigration("create_events_table", CreateEventsTable);
|
||||||
DoMigration("allow_null_target", AllowNullTarget);
|
DoMigration("allow_null_target", AllowNullTarget);
|
||||||
|
DoMigration("update_event_type_names", UpdateEventTypeNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateEventTypeNames() {
|
||||||
|
RunCommand(@"UPDATE sqc_events SET event_type = ""msg:add"" WHERE event_type = ""SharpChat.Events.ChatMessage""");
|
||||||
|
RunCommand(@"UPDATE sqc_events SET event_type = ""user:connect"" WHERE event_type = ""SharpChat.Events.UserConnectEvent""");
|
||||||
|
RunCommand(@"UPDATE sqc_events SET event_type = ""user:disconnect"" WHERE event_type = ""SharpChat.Events.UserDisconnectEvent""");
|
||||||
|
RunCommand(@"UPDATE sqc_events SET event_type = ""chan:join"" WHERE event_type = ""SharpChat.Events.UserChannelJoinEvent""");
|
||||||
|
RunCommand(@"UPDATE sqc_events SET event_type = ""chan:leave"" WHERE event_type = ""SharpChat.Events.UserChannelLeaveEvent""");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AllowNullTarget() {
|
private void AllowNullTarget() {
|
||||||
|
|
|
@ -26,7 +26,6 @@ namespace SharpChat.Packet {
|
||||||
|
|
||||||
switch(Event.Type) {
|
switch(Event.Type) {
|
||||||
case "msg:add":
|
case "msg:add":
|
||||||
case "SharpChat.Events.ChatMessage":
|
|
||||||
if(isBroadcast) {
|
if(isBroadcast) {
|
||||||
sb.Append(V1_CHATBOT);
|
sb.Append(V1_CHATBOT);
|
||||||
} else {
|
} else {
|
||||||
|
@ -58,22 +57,18 @@ namespace SharpChat.Packet {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "user:connect":
|
case "user:connect":
|
||||||
case "SharpChat.Events.UserConnectEvent":
|
|
||||||
sb.AppendFormat("{0}\t0\fjoin\f{1}", V1_CHATBOT, Event.Sender?.LegacyName);
|
sb.AppendFormat("{0}\t0\fjoin\f{1}", V1_CHATBOT, Event.Sender?.LegacyName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "chan:join":
|
case "chan:join":
|
||||||
case "SharpChat.Events.UserChannelJoinEvent":
|
|
||||||
sb.AppendFormat("{0}\t0\fjchan\f{1}", V1_CHATBOT, Event.Sender?.LegacyName);
|
sb.AppendFormat("{0}\t0\fjchan\f{1}", V1_CHATBOT, Event.Sender?.LegacyName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "chan:leave":
|
case "chan:leave":
|
||||||
case "SharpChat.Events.UserChannelLeaveEvent":
|
|
||||||
sb.AppendFormat("{0}\t0\flchan\f{1}", V1_CHATBOT, Event.Sender?.LegacyName);
|
sb.AppendFormat("{0}\t0\flchan\f{1}", V1_CHATBOT, Event.Sender?.LegacyName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "user:disconnect":
|
case "user:disconnect":
|
||||||
case "SharpChat.Events.UserDisconnectEvent":
|
|
||||||
sb.AppendFormat(
|
sb.AppendFormat(
|
||||||
"{0}\t0\f{1}\f{2}",
|
"{0}\t0\f{1}\f{2}",
|
||||||
V1_CHATBOT,
|
V1_CHATBOT,
|
||||||
|
|
Loading…
Reference in a new issue