Exemplo n.º 1
0
    public void StartByInvitation(Friend friend, OperationCompleteEvent opCompleteEvent, object tag)
    {
        object[] objs = (object[])tag;
        string sbIP = (string)objs[0];
        int sbPort = (int)objs[1];
        string hash = (string)objs[2];
        string sessionID = (string)objs[3];

        try
        {
            Proxy.IConnection conn = this.control.CreateConnection();
            conn.Connect("", 0, sbIP, sbPort, Proxy.ConnectionType.Tcp);
            sbRouter = new MessageRouter(this.protocol, conn, null, null);

            RegisterCodeEvents();

            sbRouter.SendMessage(Message.ConstructMessage("ANS",
                this.settings.Username + " " + hash + " " + sessionID),
                new ResponseReceivedHandler(OnAnswerResponse), opCompleteEvent);
        }
        catch
        {
            opCompleteEvent.Execute(new OperationCompleteArgs("Could not connect", true));
        }
    }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="opCompleteEvent"></param>
 /// <param name="tag"></param>
 public void StartInvitedConversation(Friend friend, OperationCompleteEvent opCompleteEvent, object tag)
 {
     foreach (IProtocolListener listener in this.listenerList)
     {
         listener.OnInvitedToConversation(friend, opCompleteEvent, tag);
     }
 }
Exemplo n.º 3
0
    public void Say(string text, OperationCompleteEvent opCompleteEvent)
    {
        string mimeHeader = "MIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8\r\nX-MMS-IM-Format: FN=Microsoft%20Sans%20Serif; CO=000000; CS=0; PF=22\r\n\r\n";

        int length = mimeHeader.Length + text.Length;

        sbRouter.SendMessage(Message.ConstructMessage("MSG", "A " + length + "\r\n" + mimeHeader + text), new ResponseReceivedHandler(OnSayAck), opCompleteEvent, false);
    }
Exemplo n.º 4
0
 public void End(OperationCompleteEvent opCompleteEvent)
 {
     if (sbRouter != null)
     {
         sbRouter.SendMessage(Message.ConstructMessage("OUT", string.Empty, string.Empty, false));
         sbRouter.Close();
     }
     opCompleteEvent.Execute(new OperationCompleteArgs());
 }
Exemplo n.º 5
0
    public void StartByInvitation(Friend friend, OperationCompleteEvent opCompleteEvent, object tag)
    {
        this.friend = friend;
        opCompleteEvent.Execute(new OperationCompleteArgs());
        Message message = (Message)tag;
        this.control.FriendSay(friend, message.GetArgumentString(14));

        this.protocol.conversationTable.Add(friend.Username, this);
    }
Exemplo n.º 6
0
    public void SendTypingNotification(OperationCompleteEvent opCompleteEvent)
    {
        string body = "MIME-Version: 1.0\r\n"
            + "Content-Type: text/x-msmsgscontrol\r\n"
            + "TypingUser: "******"\r\n\r\n\r\n";

        this.sbRouter.SendMessage( Message.ConstructMessage("MSG", "U " + body.Length, body, true), false );

        opCompleteEvent.Execute(new OperationCompleteArgs());
    }
Exemplo n.º 7
0
 public void SendFile(IO.Stream stream, OperationCompleteEvent opCompleteEvent)
 {
     opCompleteEvent.Execute(new OperationCompleteArgs());
 }
Exemplo n.º 8
0
 public void InviteFriend(Friend friend, OperationCompleteEvent opCompleteEvent)
 {
     sbRouter.AddCodeEvent("JOI", new ResponseReceivedHandler(OnJoinAfterInvite), opCompleteEvent);
     sbRouter.SendMessage(Message.ConstructMessage("CAL", friend.Username), new ResponseReceivedHandler(OnInviteFriendComplete), opCompleteEvent);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Call this when the plugin receives an invitation to a conversation
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="opCompleteEvent"></param>
 /// <param name="tag">Plugin defined object</param>
 public void StartInvitedConversation(Friend friend, OperationCompleteEvent opCompleteEvent, object tag)
 {
     this.server.StartInvitedConversation(friend, opCompleteEvent, tag);
 }
Exemplo n.º 10
0
 public void Say(string text, OperationCompleteEvent opCompleteEvent)
 {
     protocol.Say(friend.Username, text, opCompleteEvent);
 }
Exemplo n.º 11
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="opCompleteEvent"></param>
 /// <param name="tag"></param>
 public void OnInvitedToConversation(Friend friend, OperationCompleteEvent opCompleteEvent, object tag)
 {
     this.debug.WriteLine("Conversation invite received from " + friend.Username);
 }
Exemplo n.º 12
0
 public void End(OperationCompleteEvent opCompleteEvent)
 {
     this.protocol.conversationTable.Remove(friend.Username);
     opCompleteEvent.Execute(new OperationCompleteArgs());
 }
Exemplo n.º 13
0
 public void InviteFriend(Friend friend, OperationCompleteEvent opCompleteEvent)
 {
     opCompleteEvent.Execute(new OperationCompleteArgs());
 }
Exemplo n.º 14
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="opCompleteEvent"></param>
 /// <param name="tag"></param>
 public void OnInvitedToConversation(Friend friend, OperationCompleteEvent opCompleteEvent, object tag)
 {
 }
Exemplo n.º 15
0
        /// <summary>
        /// Connect the conversation up.
        /// </summary>
        /// <param name="byinvite">True if the conversation was initiated by someone on the contact list, false if the user clicked on the name</param>
        /// <param name="tag">If the conversation was started by someone on the contact list, this is a plugin-defined object</param>
        /// <param name="opCompleteEvent"></param>
        public void Connect(bool byinvite, object tag, OperationCompleteEvent opCompleteEvent)
        {
            this.conversationServer = new ConversationServer(this.protocol.Server);

            this.conversationServer.AddListener(this);
            this.conversationServer.AddListener(log);

            this.conversation = this.protocol.ClassFactory.CreateConversation(
                this.protocol.IProtocol,
                new ConversationControl(this.conversationServer),
                this.protocol.Settings);

            opCompleteEvent.RegisterEvent(new OperationCompleteHandler(OnConnectionComplete));

            if (byinvite)
                this.conversation.StartByInvitation(this.originalFriend, opCompleteEvent, tag);
            else
                this.conversation.Start(this.originalFriend, opCompleteEvent);

            this.connectionInProgress = true;
        }
Exemplo n.º 16
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="opCompleteEvent"></param>
 /// <param name="tag"></param>
 public void StartInvitedConversation(Friend friend, OperationCompleteEvent opCompleteEvent, object tag)
 {
     foreach (IProtocolListener listener in this.listenerList)
     {
         listener.OnInvitedToConversation(friend, opCompleteEvent, tag);
     }
 }
Exemplo n.º 17
0
 public void Start(Friend friend, OperationCompleteEvent opCompleteEvent)
 {
     protocol.notifyRouter.SendMessage(Message.ConstructMessage("XFR", "SB"),
         new ResponseReceivedHandler(OnSwitchBoardRequestResponse),
         new object[] { friend, opCompleteEvent });
 }
Exemplo n.º 18
0
 public void Start(Friend friend, OperationCompleteEvent opCompleteEvent)
 {
     this.friend = friend;
     this.protocol.conversationTable.Add(friend.Username, this);
     opCompleteEvent.Execute(new OperationCompleteArgs());
 }
Exemplo n.º 19
0
 public void SendTypingNotification(OperationCompleteEvent opCompleteEvent)
 {
     protocol.SendTypingNotification(this.friend, opCompleteEvent);
 }
Exemplo n.º 20
0
 /// <summary>
 /// Call this when the plugin receives an invitation to a conversation
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="opCompleteEvent"></param>
 /// <param name="tag">Plugin defined object</param>
 public void StartInvitedConversation(Friend friend, OperationCompleteEvent opCompleteEvent, object tag)
 {
     this.server.StartInvitedConversation(friend, opCompleteEvent, tag);
 }