Commits

Ryan Stecker committed 8ef24e2

Added Conversation.Creator, Conversation.CreationTime, Conversation.PostText, Conversation.Rename, Conversation.SetTopic.
Added Message.Conversation, Message.CanEdit, Message.Time.
Added Participant.Conversation, Participant.Rank.

Comments (0)

Files changed (5)

SkypeKit.NET/Conversation.cs

             get { return ( ConversationType )conversation.getType().ordinal(); }
         }
 
+        public string Creator
+        {
+            get { return conversation.getCreator(); }
+        }
+
+        public DateTime CreationTime
+        {
+            get { return Utils.UnixTimeToDateTime( conversation.getCreationTimestamp() ); }
+        }
+
         public string DisplayName
         {
             get { return conversation.getDisplayName(); }
             get { return conversation.getIdentity(); }
         }
 
+        public DateTime LastActivityTime
+        {
+            get { return Utils.UnixTimeToDateTime( conversation.getLastActivityTimestamp() ); }
+        }
+
 
         internal Conversation( Skype skype, SkypeConversation conversation )
         {
             }
 
             return participants
-                .Select( p => new Participant( skype, p ) )
+                .Select( p => new Participant( skype, conversation, p ) )
                 .ToArray();
         }
 
+
+        public void PostText( string message, bool bIsXml = true )
+        {
+            conversation.postText( message, bIsXml );
+        }
+
+        public void Rename( string newName )
+        {
+            conversation.renameTo( newName );
+        }
+
+        public void SetTopic( string topic, bool bIsXml = true )
+        {
+            conversation.setTopic( topic, bIsXml );
+        }
+
     }
 }

SkypeKit.NET/Message.cs

         SkypeMessage message;
 
 
+        public Conversation Conversation
+        {
+            get { return new Conversation( skype, conversation ); }
+        }
+
         public MessageType Type
         {
             get { return ( MessageType )message.getType().ordinal(); }
         public string Body
         {
             get { return message.getBodyXml(); }
+            set
+            {
+                if ( !CanEdit )
+                {
+                    throw new InvalidOperationException( "This message cannot be edited" );
+                }
+
+                message.edit( value, true, false );
+            }
+        }
+
+        public bool CanEdit
+        {
+            get { return message.canEdit(); }
+        }
+
+        public DateTime Time
+        {
+            get { return Utils.UnixTimeToDateTime( message.getTimestamp() ); }
         }
 
 

SkypeKit.NET/Participant.cs

 using System.Diagnostics;
 
 using com.skype.api;
+
 using SkypeParticipant = com.skype.api.Participant;
+using SkypeConversation = com.skype.api.Conversation;
 
 
 namespace SkypeKit
 {
+    public enum ParticipantRank
+    {
+        Creator = 0,
+        Admin,
+        Speaker,
+        Writer,
+        Spectator,
+        Applicant,
+        Retired,
+        Outlaw
+    }
+
     [DebuggerDisplay( "Identity = {Identity}, LiveIdentity = {LiveIdentity}" )]
     public sealed class Participant
     {
         Skype skype;
+        SkypeConversation conversation;
         SkypeParticipant participant;
 
 
+        public Conversation Conversation
+        {
+            get { return new Conversation( skype, conversation ); }
+        }
+
         public string Identity
         {
             get { return participant.getIdentity(); }
             get { return participant.getLiveIdentity(); }
         }
 
+        public ParticipantRank Rank
+        {
+            get { return ( ParticipantRank )participant.getRank().ordinal(); }
+        }
 
-        internal Participant( Skype skype, SkypeParticipant participant )
+
+        internal Participant( Skype skype, SkypeConversation conversation, SkypeParticipant participant )
         {
             this.skype = skype;
+            this.conversation = conversation;
             this.participant = participant;
         }
     }

SkypeKit.NET/SkypeKit.NET.csproj

     <Compile Include="ClientEvents.cs" />
     <Compile Include="SkypeException.cs" />
     <Compile Include="Participant.cs" />
+    <Compile Include="Utils.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

SkypeKit.NET/Utils.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace SkypeKit
+{
+    static class Utils
+    {
+        public static DateTime UnixTimeToDateTime( double timestamp )
+        {
+            DateTime origin = new DateTime( 1970, 1, 1, 0, 0, 0, 0 );
+            return origin.AddSeconds( timestamp );
+        }
+
+        public static double DateTimeToUnixTime( DateTime date )
+        {
+            DateTime origin = new DateTime( 1970, 1, 1, 0, 0, 0, 0 );
+            TimeSpan diff = date - origin;
+            return Math.Floor( diff.TotalSeconds );
+        }
+    }
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.