Esempio n. 1
0
 internal NTopic(TTopic message)
 {
     Topic     = new NTopicId(message.Topic);
     Presences = new List <INUserPresence>();
     foreach (var presence in message.Presences)
     {
         Presences.Add(new NUserPresence(presence));
     }
     Self = new NUserPresence(message.Self);
 }
Esempio n. 2
0
        internal NTopicPresence(TopicPresence message)
        {
            Topic = new NTopicId(message.Topic);
            Join  = new List <INUserPresence>();
            Leave = new List <INUserPresence>();

            foreach (var item in message.Joins)
            {
                Join.Add(new NUserPresence(item));
            }
            foreach (var item in message.Leaves)
            {
                Leave.Add(new NUserPresence(item));
            }
        }
Esempio n. 3
0
        internal NTopicMessage(TopicMessage message)
        {
            Topic     = new NTopicId(message.Topic);
            UserId    = message.UserId.ToByteArray();
            MessageId = message.MessageId.ToByteArray();
            CreatedAt = message.CreatedAt;
            ExpiresAt = message.ExpiresAt;
            Handle    = message.Handle;

            switch (message.Type)
            {
            case 0:
                Type = TopicMessageType.Chat;
                break;

            case 1:
                Type = TopicMessageType.GroupJoin;
                break;

            case 2:
                Type = TopicMessageType.GroupAdd;
                break;

            case 3:
                Type = TopicMessageType.GroupLeave;
                break;

            case 4:
                Type = TopicMessageType.GroupKick;
                break;

            case 5:
                Type = TopicMessageType.GroupPromoted;
                break;
            }

            Data = message.Data.ToByteArray();
        }