Chat rooms

This commit is contained in:
Paul Schneider 2019-05-10 09:58:09 +01:00
commit 6ad9b82174
23 changed files with 3641 additions and 341 deletions

View file

@ -0,0 +1,12 @@
namespace Yavsc
{
/// <summary>
/// Chat User Flags
/// </summary>
public enum ChatUserFlags : byte
{
away = 1,
invisible = 2,
cop = 4
}
}

View file

@ -61,9 +61,8 @@ namespace Yavsc
public const string HubGroupAnonymous = "anonymous";
public const string HubGroupCops= "cops";
public const int MaxChanelName = 255;
}
public static class NotificationTypes {
public const string Connected = "connected";
public const string DisConnected = "disconnected";
public const string AnonymousUserNamePrefix = "?";
public const string KeyParamChatUserName = "username";
}
}

View file

@ -0,0 +1,6 @@
namespace Yavsc
{
public static class ErrorMessages {
public const string ContactRefused = "contact refused";
}
}

View file

@ -15,8 +15,11 @@ namespace Yavsc.Models.Access
[Required]
public string OwnerId { get; set; }
[ForeignKey("OwnerId"),JsonIgnore]
[ForeignKey("OwnerId"), JsonIgnore]
public virtual ApplicationUser Owner { get; set; }
[ForeignKey("UserId"), JsonIgnore]
public virtual ApplicationUser User { get; set; }
}
}

View file

@ -1,12 +1,14 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Yavsc.Abstract.Chat;
namespace Yavsc.Models.Chat
{
public class ChatRoom: IChatRoom<ChatRoomAccess>
public class ChatRoom: IChatRoom<ChatRoomAccess>, IBaseTrackedEntity
{
public string Topic { get; set; }
@ -16,11 +18,17 @@ namespace Yavsc.Models.Chat
public string OwnerId { get; set; }
[ForeignKey("OwnerId")]
[ForeignKey("OwnerId")][JsonIgnore]
public virtual ApplicationUser Owner { get; set; }
[InverseProperty("Room")]
[InverseProperty("Room")][JsonIgnore]
public virtual List<ChatRoomAccess> Moderation { get; set; }
public DateTime LatestJoinPart { get; set;}
public DateTime DateCreated { get; set; }
public string UserCreated { get; set; }
public DateTime DateModified { get; set;}
public string UserModified { get; set; }
}
}

View file

@ -25,8 +25,6 @@ namespace Yavsc.Models.Chat
get; set;
}
[ForeignKey("UserId")]
public virtual ApplicationUser User { get; set; }
}

View file

@ -0,0 +1,13 @@
namespace Yavsc
{
public static class NotificationTypes {
public const string Connected = "connected";
public const string DisConnected = "disconnected";
public const string Reconnected = "reconnected";
public const string UserPart = "userpart";
public const string UserJoin = "userjoin";
public const string PrivateMessageDenied = "deniedpv";
public const string Error = "error";
}
}

View file

@ -0,0 +1,33 @@
namespace Yavsc
{
public static class ServerCommands {
public const string whois = nameof(whois);
public const string whowas = nameof(whowas);
/// <summary>
/// modify a chan or an user
/// </summary>
/// <returns></returns>
public const string mode = nameof(mode);
/// <summary>
/// register a channel
/// </summary>
/// <returns></returns>
public const string register = nameof(register);
/// <summary>
/// kick some user
/// </summary>
/// <returns></returns>
public const string kick = nameof(kick);
/// <summary>
/// ban an user
/// </summary>
/// <returns></returns>
public const string ban = nameof(ban);
}
}