Example #1
0
        private void OnAliceOTRMangerEventHandler(object source, OTREventArgs e)
        {
            switch (e.GetOTREvent())
            {
            case OTR_EVENT.MESSAGE:
                log.Items.Add(String.Format("{0}: {1} \n", e.GetSessionID(), e.GetMessage()));
                if (_alice_convo_pos < _alice_convo_array.Length)
                {
                    _alice_convo_pos++;
                    _alice_otr_session_manager.EncryptMessage(_alice_my_buddy_unique_id, _alice_convo_array[_alice_convo_pos - 1]);
                }
                break;

            case OTR_EVENT.SEND:
                SendDataOnNetwork(_alice_unique_id, e.GetMessage());
                break;

            case OTR_EVENT.ERROR:
                log.Items.Add(String.Format("Alice: OTR Error: {0} \n", e.GetErrorMessage()));
                log.Items.Add(String.Format("Alice: OTR Error Verbose: {0} \n", e.GetErrorVerbose()));
                break;

            case OTR_EVENT.READY:
                log.Items.Add(String.Format("Alice: Encrypted OTR session with {0} established \n", e.GetSessionID()));
                _alice_convo_pos++;
                _alice_otr_session_manager.EncryptMessage(_alice_my_buddy_unique_id, _alice_convo_array[_alice_convo_pos - 1]);
                break;

            case OTR_EVENT.DEBUG:
                log.Items.Add(String.Format("Alice: " + e.GetMessage() + "\n"));
                break;

            case OTR_EVENT.EXTRA_KEY_REQUEST:
                break;

            case OTR_EVENT.SMP_MESSAGE:
                log.Items.Add(String.Format("Alice: " + e.GetMessage() + "\n"));
                break;

            case OTR_EVENT.CLOSED:
                log.Items.Add(String.Format("Alice: Encrypted OTR session with {0} closed \n", e.GetSessionID()));
                break;
            }
        }
Example #2
0
        public void OnEvent(object source, OTREventArgs e)
        {
            switch (e.GetOTREvent())
            {
            case OTR_EVENT.MESSAGE:

                break;

            case OTR_EVENT.SEND:

                break;

            case OTR_EVENT.ERROR:

                break;

            case OTR_EVENT.READY:

                break;

            case OTR_EVENT.DEBUG:

                break;

            case OTR_EVENT.EXTRA_KEY_REQUEST:

                break;

            case OTR_EVENT.SMP_MESSAGE:

                break;

            case OTR_EVENT.CLOSED:

                break;
            }
        }
Example #3
0
        private void OnOTREvent(object source, OTREventArgs e)
        {
            switch (e.GetOTREvent ()) {
                //gets fired if a message is received
                case OTR_EVENT.MESSAGE:
                    //save received message using the conversation manager
                    m_ConversationManager.addMessage (ECommunicationProtocol.XMPP, e.GetMessage (), e.GetSessionID (), m_OwnJid);
                    break;

                //gets fired if a message is ready to be sent
                case OTR_EVENT.SEND:
                    sendXmppMessage (e.GetSessionID (), e.GetMessage ());
                    break;

                case OTR_EVENT.ERROR:

                      Console.WriteLine(" OTR Error: {0} \n", e.GetErrorMessage());
                      Console.WriteLine(" OTR Error Verbose: {0} \n", e.GetErrorVerbose());

                    break;

                case OTR_EVENT.READY:
                    //TODO: implement store to know if an otr session is established

                    break;
                case OTR_EVENT.DEBUG:
                m_Logger.log(ELogLevel.LVL_DEBUG, e.GetMessage(), m_sModuleName);
                    break;
                case OTR_EVENT.EXTRA_KEY_REQUEST:
                    m_OtrSessionManager.GetExtraSymmetricKey(e.GetSessionID());
                    break;

                case OTR_EVENT.SMP_MESSAGE:
                    Console.WriteLine ("SMP-Event: " + e.GetSMPEvent ().ToString ());
                    //TODO: check message state
                    break;

                case OTR_EVENT.CLOSED:
                    //TODO: set session state to not otr encrypted
                    break;
            }
        }