static void Main(string[] args)
    {
        Skype skype = new Skype();

        if (!skype.Client.IsRunning)
        {
            // start minimized with no splash screen
            skype.Client.Start(true, true);
        }

        // wait for the client to be connected and ready
        skype.Attach(6, true);

        // access skype objects
        Console.WriteLine("Missed message count: {0}", skype.MissedMessages.Count);

        // do some stuff
        Console.WriteLine("Enter a skype name to search for: ");
        string username = Console.ReadLine();

        foreach (User user in skype.SearchForUsers(username))
        {
            Console.WriteLine(user.FullName);
        }

        Console.WriteLine("Say hello to: ");
        username = Console.ReadLine();
        skype.SendMessage(username, "Hello World");
    }
Beispiel #2
0
 public void SendMessageToCallPartner(string message)
 {
     foreach (Call call in Skype.ActiveCalls)
     {
         Skype.SendMessage(call.PartnerHandle, message);
     }
 }
 public SkypeCallClass(string Cmd, int Timeout)
 {
     this.sp         = (Skype)Activator.CreateInstance(System.Type.GetTypeFromCLSID(new Guid("830690FC-BF2F-47A6-AC2D-330BCB402664")));
     this.sp_Command = (SKYPE4COMLib.Command)Activator.CreateInstance(System.Type.GetTypeFromCLSID(new Guid("2DBCDA9F-1248-400B-A382-A56D71BF7B15")));
     this.cmd        = Cmd;
     this.timeout    = Timeout;
 }
Beispiel #4
0
        static void Main(string[] args)
        {
            Skype skype = new Skype();

            // Initialize Botinfo.
            BotInfo botinfo = new BotInfo();

            botinfo.BotName          = "TestBot";
            botinfo.BotVersion       = "v1.0";
            botinfo.BotCreator       = "Thr";
            botinfo.CommandDelimiter = "!";
            botinfo.foreground       = ConsoleColor.White;
            botinfo.background       = ConsoleColor.Blue;
            botinfo.Logging          = true;
            // Set compression filesize.
            botinfo.FileSize = 100;
            // Intialize Bot.
            Bot bot = new Bot(skype, botinfo);

            bot.HelpMessage          += bot_HelpMessage;          // Custom help message header.
            bot.IgnoredMessage       += bot_IgnoredMessage;       // Custom ignored user message.
            bot.InvalidMessage       += bot_InvalidMessage;       // Custom Invalid message text.
            bot.MessageReceived      += bot_MessageReceived;      // Override the message_received and either allow it or not based off of your own defined events.
            bot.UserRequest_Received += bot_UserRequest_Received; // Override the user request and allow it or deny it.
        }
    static void Main(string[] args)
    {
        Skype skype = new Skype();

        if (!skype.Client.IsRunning)
        {
            // start minimized with no splash screen
            skype.Client.Start(true, true);
        }

        // wait for the client to be connected and ready
        skype.Attach(6, true);

        // access skype objects
        Console.WriteLine("Missed message count: {0}", skype.MissedMessages.Count);

        // do stuff
        string          username = "******";
        IUserCollection users    = skype.SearchForUsers(username);

        if (users.Count > 0)
        {
            User user = users[1];
            Console.WriteLine(user.FullName);
        }

        skype.SendMessage(username, "Hello World");
    }
Beispiel #6
0
        static public void OpenSkype()
        {
            MessageBox.Show("To be able to use Video in skype we have to stop the camera in GemScope");

            Capture capture = Capture.GetInstance();

            capture.Stop();

            Skype skype = new Skype();

            if (!skype.Client.IsRunning)
            {
                try
                {
                    skype.Client.Start();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("There was a problem opennig skype:\n" + ex.Message);
                }
            }
            else
            {
                skype.Client.Focus();
            }
        }
        private void OutputMoodMessage(track track)
        {
            var skype = new Skype();

            if (!skype.Client.IsRunning)
            {
                return;
            }

            // Get format message
            var msg = ConfigurationManager.AppSettings["MoodMessage"];

            if (msg == null)
            {
                msg = "Now Playing: {0}";
            }

            // Apply match replacements
            msg = Regex.Replace(msg, "%name%", track.name ?? String.Empty);
            msg = Regex.Replace(msg, "%artist%", track.artist ?? String.Empty);
            msg = Regex.Replace(msg, "%album%", track.album ?? String.Empty);
            msg = Regex.Replace(msg, "%date%", track.date ?? String.Empty);
            msg = Regex.Replace(msg, "%url%", track.url ?? String.Empty);

            // Set mood message
            skype.CurrentUserProfile.RichMoodText = msg;
        }
        static void Main(string[] args)
        {
            Skype _skype = new Skype();

            try
            {
                _skype.Attach(5, false);
                Console.Write("Connectie succesvol");
                if (!_skype.Client.IsRunning)
                {
                    _skype.Client.Start(false, true);
                }

                System.Threading.Thread.Sleep(5000);

                if (_skype.Client.IsRunning == true)
                {
                    string line;

                    string path = string.Join(Directory.GetCurrentDirectory(), "./config.txt");

                    StreamReader file =
                        new StreamReader(path);

                    line = file.ReadLine();

                    Call call = _skype.PlaceCall(line);
                }
            }
            catch
            {
                Console.Write("Connectie onsuccesvol");
            }
        }
Beispiel #9
0
        public static void OpenSkype()
        {
            MessageBox.Show("To be able to use Video in skype we have to stop the camera in GemScope");

            Capture capture = Capture.GetInstance();
            capture.Stop();

            Skype skype = new Skype();
            if (!skype.Client.IsRunning)
            {
                try
                {
                    skype.Client.Start();

                }
                catch (Exception ex)
                {

                    MessageBox.Show("There was a problem opennig skype:\n" + ex.Message);

                }

            }
            else
            {
                skype.Client.Focus();
            }
        }
 private CallAudioStreamServer(Skype skype)
     : base(IPAddress.Any, listeningPort)
 {
     logger.Info("Singleton constructed");
     this.skype = skype;
     this.Start();
 }
Beispiel #11
0
 public bool InitSkype()
 {
     try
     {
         if (IsProcessOpen("Skype"))
         {
             _skype = new Skype();
             // Use skype protocol version 7
             _skype.Attach(7, false);
             // Listen
             _skype.MessageStatus += skype_MessageStatus;
             ((_ISkypeEvents_Event)_skype).AttachmentStatus += new _ISkypeEvents_AttachmentStatusEventHandler(SkypePopDialog_AttachmentStatus);
             _chats = _skype.ActiveChats;
             RefreshActiveChats();
             if (_chats.Count > 0)
             {
                 cmbActiveChats.SelectedIndex = 0;
             }
             return true;
         }
         else
         {
             CueProvider.SetCue(txtSend, "Waiting untill Skype starts... ");
             _skypeReconnectTime.Enabled = true;
             return false;
         }
     }
     catch(Exception ex)
     {
         CueProvider.SetCue(txtSend, "Waiting untill Skype starts... ");
         _skypeReconnectTime.Enabled = true;
         return false;
     }
 }
        public SkypeInterface()
        {
            Skype = new Skype();
            Skype.Attach();

            Chat = Skype.Chat[ConfigurationManager.AppSettings["chatname"]];
        }
 public SkypeAudioController()
 {
     skype = new Skype();
     de = new MMDeviceEnumerator();
     SetDefaultAudioDevices();
     de.RegisterEndpointNotificationCallback(this);
 }
Beispiel #14
0
 private void Form1_Load(object sender, EventArgs e)
 {
     skype = new Skype();
     skype.Attach(8, false);
     // Listen
     skype.MessageStatus += new _ISkypeEvents_MessageStatusEventHandler(skype_MessageStatus);
 }
Beispiel #15
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     Log("All logs will be visible in this box");
     skype = new SKYPE4COMLib.Skype();
     ((_ISkypeEvents_Event)skype).AttachmentStatus += OnAttach;
     skype.CallStatus += MainForm_CallStatus;
 }
Beispiel #16
0
        public string Main(string command, string sender, Skype skype)
        {
            if (command.Split(' ').Length == 0)
                return "You need to specify a host to resolve!";

            return Dns.GetHostAddresses(command.Split(' ')[1])[0].ToString();
        }
Beispiel #17
0
        public string Main(string command, string sender, Skype skype)
        {
            if (command.Remove(0, command.Split(' ')[0].Length) == "")
                return "You can't just expect me to pull words out of my ass, here. Give me something to say.";

            return command.Remove(0, command.Split(' ')[0].Length);
        }
Beispiel #18
0
        /**
         * SkypeListener Override: Tutorial Handler - App2App Stream List.
         * <br /><br />
         * In the context of Tutorial 11 datagrams, this event fires when:
         * <ol>
         *   <li>Connection is established between two app2app applications. That is, when
         *	     both parties have an app up with the same name and <em>both</em> used App2AppConnect
         *	     In that case, both parties get this event, with listType ALL_STREAMS</li>
         *   <li>When a datagram is sent, the sender will get this event with listType SENDING_STREAMS
         *	     Receiver of the datagram will get onApp2AppDatagram event instead.</li>
         *   <li>When the remote party drops app2app connection, the local user will get
         *	     onApp2AppStreamListChange with listType ALL_STREAMS and streams.length zero,
         *	     which is useful for detecting remote drops.</li>
         * </ol>
         *
         * @param appname
         *  The name of the application associated with this datagram connection.
         * @param listType
         *  The type of the affected stream(s) - sending, receiving, or "all"
         * @param streams
         *  The names of the affected stream(s). In the context of Tutorial 11 datagrams,
         *  we assume that there are only 2 participants and so th enumber of streams should be either
         *  0 (zero; remote shutdown) or 1 (one; initiated/datagram sent).
         *
         * @since 1.0
         *
         * @see com.skype.api.SkypeListener#onApp2AppStreamListChange(Skype, String, Skype.App2AppStreams, String[], int[])
         */
        public void onApp2AppStreamListChange(Skype Object, String appname, Skype.App2AppStreams listType, String[] streams, int[] receivedSizes)
        {
            //		int streamsCount = streams.length;

            /*
             *      if (streamsCount != 0) {
             *          // Normally the streamCount in this event should be either 1 or 0.
             *          // More streams are possible when there are more than 2 connected
             *          // participants running the same application. For purposes of this
             *          // example, we will assume that there are only 2 participants.
             *          int i;
             *          for (i = 0; i < streamsCount; i++) {
             *              MySession.myConsole.printf("onApp2AppStreamListChange: %s %s %s%n",
             *                      mySession.mySkype.StreamListType(listType), appname, streams[i]);
             *              mySession.mySkype.streamName = streams[i]; // We're assuming only one stream!
             *                                                              // If two or more, last one wins!
             *          }
             *
             *          if (!appConnected) {
             *              appConnected = true;
             *              MySession.myConsole.printf("You can now type and send datagrams to remote instance.%n");
             *          }
             *      }
             *      else if (listType == Skype.APP2APP_STREAMS.ALL_STREAMS) {
             *              // Remote side dropped connection.
             *              MySession.myConsole.printf("No more app2app streams.%n");
             *              mySession.mySkype.streamName = "";
             *      }
             */
        }
Beispiel #19
0
        public SkypeProxy(int timeOutInSeconds)
        {
            try {
                skype = new Skype();
            }
            catch (Exception) {
                throw new SkypeServerException();
            }
            logger.Info("Skype instance created successfully.");
            Semaphore attachmentSemaphore = new Semaphore(0, 1);
            Thread    waitingThread       = new Thread(new ParameterizedThreadStart(attachmentWaitingThreadProc));

            waitingThread.IsBackground = true;
            waitingThread.Start(attachmentSemaphore);
            bool attachmentOk = attachmentSemaphore.WaitOne(1000 * timeOutInSeconds);

            if (!attachmentOk)
            {
                logger.Info("Can't attach to Skype (user applying timeout)");
                throw new UserNotAppliedAttachmentException();
            }
            else if (skype.Client.IsRunning == false)
            {
                skype.Client.Start(false);
            }
            logger.Info("Attached to Skype successfully");
        }
Beispiel #20
0
        /**
         * SkypeListener Override: Tutorial Handler - Conversation ListType.
         * <br /><br />
         * If it's <em>not</em> a LIVE_CONVERSATIONS change, ignore it; if it's not a
         * type we're interested in, simply write it to the console.
         * <ul>
         *   <li>Tutorial 5 - Looks for RINGING_FOR_ME so we can join in.</li>
         *   <li>Tutorial 6 - Looks for IM_LIVE or RECENTLY_LIVE/NONE. Former case, indicates
         *       that a call is in progress; latter case, indicates that a call has ended.</li>
         * </ul>
         *
         * @param conversation
         *  The affected Conversation.
         * @param type
         *  The Conversation list type that triggered this event.
         * @param added
         *  Ignored.
         *
         * @since 1.0
         *
         */
        public void onConversationListChange(Skype obj, Conversation conversation, Conversation.ListType type, bool added)
        {
            MySession.myConsole.printf("%s: ConversationListChange fired on: %s%n",
                                       mySession.myTutorialTag, conversation.getDisplayName());

            if (type == Conversation.ListType.LIVE_CONVERSATIONS)
            {
                Conversation.LocalLiveStatus liveStatus = conversation.getLocalLiveStatus();
                MySession.myConsole.printf("%s: Live status changed to %s%n",
                                           mySession.myTutorialTag, liveStatus);
                if (liveStatus == Conversation.LocalLiveStatus.RINGING_FOR_ME)
                {
                    activeConversation             = conversation;
                    activeConversationParticipants = conversation.getParticipants(Conversation.ParticipantFilter.ALL);
                    conversation.join();
                    mySession.callActive = true;
                }
                else if (liveStatus == Conversation.LocalLiveStatus.RECENTLY_LIVE || liveStatus == Conversation.LocalLiveStatus.NONE)
                {
                    MySession.myConsole.printf("%s: Call finished.%n", mySession.myTutorialTag);
                    activeConversation             = null;
                    activeConversationParticipants = null;
                    mySession.callActive           = false;
                }
                else if (liveStatus == Conversation.LocalLiveStatus.IM_LIVE)
                {
                    MySession.myConsole.printf("%s: Live session is up.%n", mySession.myTutorialTag);
                }
                else
                {
                    MySession.myConsole.printf("%s: Ignoring Conversation status %s%n",
                                               mySession.myTutorialTag, liveStatus);
                }
            }
        }
Beispiel #21
0
        /**
         * SkypeListener Override: Tutorial Handler - Posted chat message.
         * <br /><br />
         * If it's <em>not</em> a POSTED_TEXT message, ignore it.
         *
         * @param message
         *  The affected Message.
         * @param changesInboxTimestamp
         *  Ignored.
         * @param supersedesHistoryMessage
         *  Ignored.
         * @param conversation
         *  The affected Conversation.
         *
         * @since 1.0
         *
         * @see com.skype.api.SkypeListener#onMessage(com.skype.api.Skype, com.skype.api.Message, boolean, com.skype.api.Message, com.skype.api.Conversation)
         */
        public void onMessage(Skype obj, Message message,
                              bool changesInboxTimestamp, Message supersedesHistoryMessage, Conversation conversation)
        {
            Message.Type msgType = message.getType();

            if (msgType == Message.Type.POSTED_TEXT)
            {
                String msgAuthor = message.getAuthor();
                String msgBody   = message.getBodyXml();
                if (!msgAuthor.Equals(mySession.myAccountName))
                {
                    // Get timestamp -- it's in seconds, and the Date ructor needs milliseconds!
                    int      msgTimeStamp  = message.getTimestamp();
                    DateTime dateTimeStamp = new DateTime((msgTimeStamp * 1000L));
                    //DateFormat targetDateFmt = DateFormat.getDateTimeInstance();
                    //MySession.myConsole.printf("%s: [%s] %s posted message%n\t%s%n",
                    //        mySession.myTutorialTag, targetDateFmt.format(dateTimeStamp), msgAuthor, msgBody);
                    MySession.myConsole.printf("%s: [%s] %s posted message%n\t%s%n",
                                               mySession.myTutorialTag, dateTimeStamp, msgAuthor, msgBody);
                    //Calendar targetDate = Calendar.getInstance();
                    //conversation.postText((targetDateFmt.format(targetDate.getTime()) + ": This is an automated reply"), false);
                }
            }
            else
            {
                MySession.myConsole.printf("%s: Ignoring SkypeListener.onMessage of type %s%n",
                                           mySession.myTutorialTag, msgType);
            }
        }
        public void FindInstance()
        {
            // Lets avoid the UI freezing
            var thread = new Thread(new ThreadStart(delegate
            {
                // If skype is startet but the user hasn't excepted the integration
                try
                {
                    Skype = new Skype();
                    Online = (Skype.Client.IsRunning && Skype.CurrentUserHandle != null);
                }
                catch (Exception)
                {
                    OnError(new ErrorEventArgs(new Exception("Please accept our application to communicate with Skype and click OK.")));
                    return;
                }

                if (!Online)
                {
                    OnError(new ErrorEventArgs(new Exception("Failed communicate with Skype.\nIs Skype open and are you sure you are signed in?\n\nClick OK to try again or Cancel to quit.")));
                    return;
                }

                OnInstanceFound(new SkypeInstanceEventArgs()
                {
                    Online = Online,
                    SkypeInstance = Skype
                });
            }));

            thread.Priority = ThreadPriority.Lowest;
            thread.Start();
        }
Beispiel #23
0
        [ExpectedException(typeof(System.Runtime.InteropServices.COMException), "System.Runtime.InteropServices.COMException")] //It will throw if you don't have an skype Instance running
        public void SkypeComCalls()                                                                                             //This method will make COM calls to a running instance of Skype
        {
            var skypeClass  = new Skype();                                                                                      //Note: On the running instance of Skype,you will get a message saying that another application wants to access Skype
            var currentUser = skypeClass.CurrentUser;                                                                           //You can interact with the COM object and execute methods and properties

            Assert.IsNotNull(currentUser.FullName);                                                                             //My skype name is being retrieved at runtime
        }
Beispiel #24
0
        private void button1_Click(object sender, EventArgs e)
        {
            SKYPE4COMLib.Skype skype = new Skype();

            try
            {
                skype.Attach();
                var usr = skype.CurrentUser;
                skype.CallStatus += Skype_CallStatus;

                var currentCall = skype.PlaceCall("echo123");//Indtast caller id her (har indtastet skypes ekko service for test)
                label1.Text = "Started: " + currentCall.Timestamp.ToString() + "";
                label2.Text = "Ended: " + currentCall.Timestamp.ToString() + "";
                Thread.Sleep(4000);

                currentCall.Finish();
                label2.Text = "Ended: " + DateTime.Now.ToString() + "";

                label3.Text = "Duration: " + (DateTime.Now - currentCall.Timestamp).TotalSeconds;
            }
            catch (COMException come)
            {
                throw;
            }
        }
Beispiel #25
0
        public SysTrayApp()
        {
            trayMenu = new ContextMenu();
            trayMenu.MenuItems.Add("Exit", OnExit);
            var statusMenuItem = new MenuItem("Set status to");
            var dndMenuItem    = new MenuItem("Do not disturb", OnDnd)
            {
                Checked = true
            };

            statusMenuItem.MenuItems.Add(dndMenuItem);
            statusMenuItem.MenuItems.Add("Away", OnAway);
            statusMenuItem.MenuItems.Add("Invisible", OnInvisible);
            statusMenuItem.MenuItems.Add("Online", OnOnline);
            trayMenu.MenuItems.Add(statusMenuItem);


            trayIcon                 = new NotifyIcon();
            trayIcon.Text            = "SkypeAutoDND";
            trayIcon.Icon            = new Icon("skypednd.ico", 40, 40);
            trayIcon.BalloonTipTitle =
                "SkypeAutoDND is running minimized!";
            trayIcon.BalloonTipText = "Remember to accept the app in skype! :)";
            trayIcon.BalloonTipIcon = ToolTipIcon.Info;

            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible     = true;
            trayIcon.ShowBalloonTip(3000);
            skype = new Skype();
            skype.Attach();

            timer          = new Timer(2000);
            timer.Elapsed += (sender, eventArgs) => ForceStatus();
            timer.Enabled  = true;
        }
Beispiel #26
0
        //This method runs when the program starts up
        private void Form1_Load(object sender, EventArgs e)
        {
            //Initial Skype Desktop API
            skype = new Skype();
            skype.Attach(7, true);
            //Hookup local event method to run when Skype status changes
            skype.OnlineStatus += Skype_OnlineStatus;
            //Retrieve the current status of the skype client
            TOnlineStatus myStatus = skype.CurrentUser.OnlineStatus;

            //Turn Skype status into a String
            label1.Text = getStatusString(myStatus);

            //Setup system tray icon (making the app able to run in the background) and not on the task bar
            notifyIcon = new System.Windows.Forms.NotifyIcon();
            notifyIcon.BalloonTipText  = "located in system tray";
            notifyIcon.BalloonTipTitle = "Skype Status Monitor for Raspberry Pi";
            notifyIcon.Text            = "Skype Status Monitor for Raspberry Pi";
            notifyIcon.Icon            = SkypeMonitor.Properties.Resources.MyIcon;
            notifyIcon.Click          += new EventHandler(HandlerToMaximiseOnClick);
            if (notifyIcon != null)
            {
                notifyIcon.Visible = true;
                notifyIcon.ShowBalloonTip(2000);
            }
            //Minimize the app to the system tray (running in the background to be less obtrusive to user)
            this.WindowState = FormWindowState.Minimized;

            //setup local area network Rest Service
            //retrieve the local IP addresses to bind the HttpService to
            ArrayList   myIps = new ArrayList();
            IPHostEntry host;

            host = Dns.GetHostEntry(Dns.GetHostName());
            foreach (IPAddress ip in host.AddressList)
            {
                if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                {
                    myIps.Add(ip.ToString());
                }
            }
            //Setup Http Server
            listener = new HttpListener();
            listener.Prefixes.Add("http://localhost:" + localServerPort + "/");
            listener.Prefixes.Add("http://127.0.0.1:" + localServerPort + "/");
            foreach (String IP in myIps)
            {
                listener.Prefixes.Add("http://" + IP + ":" + localServerPort + "/");
            }
            //No Authentication needed
            listener.AuthenticationSchemes = AuthenticationSchemes.Anonymous;
            //Spawn additional thread and run HttpService in that background thread
            continueThread = true;
            listener.Start();
            this.listenThread1 = new Thread(new ParameterizedThreadStart(startlistener));
            listenThread1.Start();
            //setup closing method to dispose of thread properly
            this.Disposed += Form1_Disposed;
        }
Beispiel #27
0
        private void Run(object parameter)
        {
            string name = string.Format("<{0}>", parameter.ToString());

            try
            {
                ISkype skype = new Skype();
                IUser user = (IUser)skype.get_User(parameter.ToString());
                name = string.Format("{0} <{1}>", user.FullName, user.Handle);

                logfile = user.Handle + ".log";

                Dispatcher.Invoke(new Action<string>(SetNewLog), user.Handle);

                Log("stalking {0}", name);

                TOnlineStatus last = TOnlineStatus.olsUnknown;

                while (true)
                {
                    TOnlineStatus now = user.OnlineStatus;

                    if (now != last)
                    {
                        Log("{0}: {1}", name, GetStatusText(now));
                        last = now;
                    }

                    Thread.Sleep(1000);
                }
            }
            catch (COMException ce)
            {
                switch ((uint)ce.ErrorCode)
                {
                    case 0x8100030a:
                        Log("User {0} not available.", name);
                        break;
                    default:
                        Log("Error 0x{0:x} happened", ce.ErrorCode);
                        break;
                }
            }
            catch (ThreadAbortException)
            {
                Log("stopping {0}", name);
            }
            catch (Exception e)
            {
                Log("Unknown error: {0}", e.Message);
            }
            finally
            {
                logfile = null;
                Dispatcher.Invoke(new Action<DependencyProperty, object>(Identifier.SetValue), Control.IsEnabledProperty, true);
                Dispatcher.Invoke(new Action<DependencyProperty, object>(StalkButton.SetValue), Control.VisibilityProperty, Visibility.Visible);
                Dispatcher.Invoke(new Action<DependencyProperty, object>(StopButton.SetValue), Control.VisibilityProperty, Visibility.Collapsed);
            }
        }
Beispiel #28
0
 public Form1()
 {
     InitializeComponent();
     skype = new Skype();
     skype.Attach(7, false);
     numericUpDown1.Maximum = skype.Chats.Count;
     //skype.MessageStatus+=new _ISkypeEvents_MessageStatusEventHandler(skype_MessageStatus);
 }
Beispiel #29
0
 private void Form1_Load(object sender, EventArgs e)
 {
     skype = new Skype();
     // Use skype protocol version 7
     skype.Attach(7, false);
     // Listen
     skype.MessageStatus += new _ISkypeEvents_MessageStatusEventHandler(skype_MessageStatus);
 }
 public static CallAudioStreamServer getServer(Skype skype)
 {
     if (serverSingleton == null)
     {
         serverSingleton = new CallAudioStreamServer(skype);
     }
     return(serverSingleton);
 }
Beispiel #31
0
        private void panel2_MouseDown(object sender, MouseEventArgs e)
        {
            Skype Axskype1 = new Skype();

            textBox2.Text = "아이디어 : " + textBox2.Text;
            Axskype1.SendMessage("sh__y_", textBox2.Text);
            textBox2.Text = "아이디어";
        }
        public SettingsForm(Skype skype) {
            InitializeComponent();

            this.skype = skype;
            loadCheckBoxes(updateCheckToggle, helpOnMinimized);
            loadNumericUpDowns(updateInterval);
            loadListBoxes(whiteList);
            loadDomainMode();
        }
Beispiel #33
0
 static void SendMessage(string sender, string message)
 {
     if (!Regex.IsMatch(message, @"^\s*$"))
     {
         Skype skype = new Skype();
         Thread.Sleep(1000);
         skype.SendMessage(sender, message);
     }
 }
Beispiel #34
0
        public SkypeHelper()
        {
            // System.Runtime.InteropServices.COMException
            _skype = new Skype();
            ((_ISkypeEvents_Event)_skype).AttachmentStatus += SkypeAttachmentStatus;
            _skype.UserStatus += SkypeUserStatus;

            _skype.Attach(SKYPE_PROTOCOL, WAIT_FOR_ATTACH);
        }
Beispiel #35
0
 public SkypeApi()
 {
     _skype             = new Skype();
     _vk                = new VKAPI();
     _vk.CaptchaNeeded += (sender, args) => chat.SendMessage(args.Text);
     _skype.Attach(SkypeVersion, false);
     _skype.MessageStatus += SkypeMessageEvent;
     chat = _skype.Chat["#skype2vkgate/$frodosa05;98f14bcb7d42e4c2"];
 }
Beispiel #36
0
        const string ytAPIKey = //removed for security reasons

        static void Main(string[] args)
        {
            //skype initialization
            sky = new SKYPE4COMLib.Skype();
            sky.Attach();

            while (true)
            {

                //autoresponse messages
                foreach (IChatMessage msg in sky.MissedMessages)
                {

                    string user = msg.Sender.Handle;
                    string[] cmds = { "!help", "!ping", "!yt [search query]" };

                    //help cmd
                    if (msg.Body.ToLower().Contains(prefix + "help") && msg.Body.IndexOf(prefix) == 0)
                    {
                        string cmdFormat = "Commands:";
                        foreach (string cmd in cmds)
                        {
                            cmdFormat += "\n\t\t" + cmd;
                        }
                        sky.SendMessage(user, "kek");
                        break;
                    }
                    //ping cmd
                    else if (msg.Body.ToLower().Contains(prefix + "ping") && msg.Body.IndexOf(prefix) == 0)
                    {
                        SendSMS(user, "pong");
                        break;
                    }
                    //youtube cmd
                    else if (msg.Body.ToLower().Contains(prefix + "yt") && msg.Body.IndexOf(prefix) == 0)
                    {
                        ytSearch = msg.Body.Remove(0, 3);
                        if (string.IsNullOrWhiteSpace(ytSearch))
                        {
                            SendSMS(user, "Incorrect syntax. Please do \"!yt <what you want to search>\" instead.");
                        }
                        else
                        {
                            new Program().YoutubeMethod().Wait();
                            SendSMS(user, ytResult);
                        }
                        break;
                        //invalid command
                    }
                    else if (msg.Body.ToLower().Contains(prefix.ToString()) && msg.Body.IndexOf(prefix) == 0)
                    {
                        SendSMS(user, "\"" + msg.Body + "\"" + " is not a valid command. Please type " + "\"!help\" for more info.");
                        break;
                    }
                }
            }
        }
        public SkypeHelper()
        {
            // System.Runtime.InteropServices.COMException
            _skype = new Skype();
            ((_ISkypeEvents_Event)_skype).AttachmentStatus += SkypeAttachmentStatus;
            _skype.UserStatus += SkypeUserStatus;

            _skype.Attach(SKYPE_PROTOCOL, WAIT_FOR_ATTACH);
        }
Beispiel #38
0
 private void Form1_Load(object sender, EventArgs e)
 {
     this.skype = (Skype) Activator.CreateInstance(System.Type.GetTypeFromCLSID(new Guid("830690FC-BF2F-47A6-AC2D-330BCB402664")));
       // ISSUE: reference to a compiler-generated method
       this.skype.Attach(7, false);
       // ISSUE: method pointer
       // ISSUE: object of a compiler-generated type is created
       new ComAwareEventInfo(typeof (_ISkypeEvents_Event), "MessageStatus").AddEventHandler((object) this.skype, (Delegate) new _ISkypeEvents_MessageStatusEventHandler((object) this, (UIntPtr) __methodptr(skype_MessageStatus)));
 }
Beispiel #39
0
        public string Main(string command, string sender, Skype skype)
        {
            string input = command.Remove(0, command.Split(' ')[0].Length + 1);

            char[] X = @"¿/˙'\‾¡zʎxʍʌnʇsɹbdouɯlʞɾıɥƃɟǝpɔqɐ".ToCharArray();
            string V = @"?\.,/_!zyxwvutsrqponmlkjihgfedcba";

            return new string((from char obj in input.ToCharArray()
                               select (V.IndexOf(obj) != -1) ? X[V.IndexOf(obj)] : obj).Reverse().ToArray());
        }
Beispiel #40
0
        private void Form2_Load(object sender, EventArgs e)
        {
            botfactory = new ChatterBotFactory();

            bot = botfactory.Create(ChatterBotType.PANDORABOTS, PandoraBotID);

            skype = new Skype();
            skype.Attach(8, true);
            skype.MessageStatus += skype_MessageStatus;
        }
Beispiel #41
0
        public static void Init()
        {
            if (Skype == null)
            {
                Skype = new SkypeClass();
                Skype._ISkypeEvents_Event_AttachmentStatus += Skype_AttachmentStatus;
            }

            Skype.Attach(Skype.Protocol, false);
        }
        private void InitializeSkype()
        {
            s = new Skype();
            _ISkypeEvents_Event events = s;

            events.AttachmentStatus += OnAttachementStatusChanged;
            events.CallStatus       += OnCallStatusChanged;

            s.Attach();
        }
Beispiel #43
0
 public SkypeManagerBase()
 {
     Skype             = new Skype();
     Skype.Reply      += SkypeReply;
     _attachmentStatus = AttachmentStatus;
     _timerAttach      = new Timer {
         Interval = 1000
     };
     _timerAttach.Tick += TimerAttachTick;
 }
Beispiel #44
0
 private void btnKetNoiSkype_Click(object sender, EventArgs e)
 {
     skypeInstant = new Skype();
     if (!skypeInstant.Client.IsRunning)
     {
         // start minimized with no splash screen
         skypeInstant.Client.Start(true, true);
     }
     skypeInstant.Attach(6, true);
 }
Beispiel #45
0
 static void Main(string[] args)
 {
     skype = new Skype();
     skype.Attach(7, false);
     skype.MessageStatus += new _ISkypeEvents_MessageStatusEventHandler(skype_MessageStatus);
     while (Console.ReadKey(true).KeyChar != 's')
     {
         ;
     }
 }
        /// <summary>
        /// The public constructor.
        /// </summary>
        /// <param name="skype">A connected Skype4COM.Skype object.</param>
        public APIEventHandler(Skype skype)
        {
            this.skype = skype;

            _callStartedHandlers = new List<DCallStartedHandler>();
            _callEndedHandlers = new List<DCallEndedHandler>();
            _chatMessageHandlers = new List<DChatMessageHandler>();

            skype.MessageStatus += onSkypeMessageStatus;
            skype.CallStatus += onSkypeCallStatus;
        }
        public void OnInitialise(Skype skype)
        {
            Logger.Debug("Initialised TextToSpeechBehaviour");

            skypeHandle = skype;

            synthesizer = new SpeechSynthesizer
            {
                Volume = 100,
                Rate = 1
            };
        }
Beispiel #48
0
        public void SetUp()
        {
            _skype = new Skype();
            if (!_skype.Client.IsRunning)
            {
                // start minimized with no splash screen
                _skype.Client.Start(true, true);
            }

            // wait for the client to be connected and ready
            _skype.Attach(7, true);
        }
Beispiel #49
0
 public string Main(string command, string sender, Skype skype)
 {
     if (command.Split(' ').Length < 3)
         return "You need to give me 2 numbers.";
     int number1;
     if (!int.TryParse(command.Split(' ')[1], out number1))
         return "Number 1 isn't a valid integer!";
     int number2;
     if (!int.TryParse(command.Split(' ')[2], out number2))
         return "Number 2 isn't a valid integer!";
     return new Random().Next(number1, number2 + 1).ToString();
 }
        public SkypeChatPicker(Skype skype) {
            InitializeComponent();

            chats = new List<String>();

            chatList.Items.Clear();
            foreach (Chat chat in skype.Chats) {
                try {
                    chats.Add(chat.Name);
                    chatList.Items.Add(chat.FriendlyName);
                } catch (COMException) { } // Skype generates invalid chats. Fun times.
            }
        }
Beispiel #51
0
        private void EnableThread(object sender, EventArgs e)
        {
            var skype = new Skype();

            if (metroTile1WasClicked == true)
            {
                if (skypeAttached == false)
                {
                    metroTile4.Visible = false;
                    skype.Attach(5, true);
                    skypeAttached = true;
                    Console.WriteLine(skypeAttached);
                }
                Console.WriteLine(gameRunning());
                if (gameRunning()) {
                    if (metroComboBox1.Text == "Away") {
                        skype.ChangeUserStatus(TUserStatus.cusAway);
                    } else if (metroComboBox1.Text == "Do Not Disturb") {
                        skype.ChangeUserStatus(TUserStatus.cusDoNotDisturb);
                    } else if (metroComboBox1.Text == "Invisible") {
                        skype.ChangeUserStatus(TUserStatus.cusInvisible);
                    }
                    else {
                        skype.ChangeUserStatus(TUserStatus.cusOffline);
                    }
                    if (metroToggle2.Checked == true)
                    {
                            skype.CurrentUserProfile.MoodText = metroTextBox1.Text;
                    }
                    metroTile3.Text = "Running";
                    metroTile3.Style = MetroFramework.MetroColorStyle.Blue;
                }
                else
                {
                    skype.ChangeUserStatus(TUserStatus.cusOnline);
                    if (metroToggle2.Checked == true)
                    {
                        skype.CurrentUserProfile.MoodText = "";
                    }
                    metroTile3.Text = "Enabled";
                    metroTile3.Style = MetroFramework.MetroColorStyle.Green;
                }
                //}
            }
            else
            {
                skype.ChangeUserStatus(TUserStatus.cusOnline);
                skype.CurrentUserProfile.MoodText = "";
            }
        }
Beispiel #52
0
        /// <summary>
        /// The public constructor.
        /// </summary>
        /// <param name="skype">A connected Skype4COM.Skype object.</param>
        /// <param name="sizeUnknownMessagesCache">Number of messages with no registered handlers to save. These messages will be deployed as soon as a matching handler gets registered.</param>
        public CommOverSkype(Skype skype, int sizeUnknownMessagesCache = 0)
        {
            this.skype = skype;
            this.maxUndeployedMessages = sizeUnknownMessagesCache;

            _surfaceMessageHandlers = new List<DSurfaceMessageHandler>();
            _surfaceSpecificMessageHandlers = new Dictionary<string, DSurfaceSpecificMessageHandler>();

            skype.MessageStatus += onSkypeMessageStatus;

            undeployedMessages = new Queue<UndeployedMessage>();
            knownMessages = new List<int>();
            firstMessages = new Dictionary<string, int>();
        }
 private void attachButton_Click(object sender, EventArgs e)
 {
     s = new Skype();
     if (attachToSkype())
     {
         this.Text = titleText + " | " + s.CurrentUser.FullName ;
         btnAttach.Enabled = false;
         btnSetStatus.Enabled = true;
     }
     else
     {
         MessageBox.Show("Error connecting to skype.", "Skype Status", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public Form1()
        {
            InitializeComponent();

            _skype = new Skype();

            _skype.Attach(Protocol: 7, Wait: true);

            _skype.OnlineStatus += OnlineStatusChanged;

            _currentStatus = this.ConvertStatusToString(_skype.CurrentUser.OnlineStatus);

            PostToService(_currentStatus);
        }
        public skypeRobotController()
        {
            this.FormClosing += delegate
            {
                serialPort.Close();
                // serialPort.
            };

            InitializeComponent();
            skype = new Skype();
            TimerCallback tcb = this.CheckStatus;
            AutoResetEvent ar = new AutoResetEvent(true);
            skype.MessageStatus += new _ISkypeEvents_MessageStatusEventHandler(skype_MessageStatus);
            time = new System.Threading.Timer(tcb, ar, 250, 250);

            //availabe COM ports
            SerialPort tmp;
            foreach (string str in SerialPort.GetPortNames())
            {
                tmp = new SerialPort(str);
                if (tmp.IsOpen == false)
                    port_combobox.Items.Add(str);
            }

            try
            {
                // Try setting our custom event handler while avoiding any ambiguity.
                ((_ISkypeEvents_Event)skype).CallStatus += OurCallStatus;

            }
            catch (Exception e)
            {
                // Write Call Status Event Handler Failed to window.
                msg_listbox.Text += string.Format(DateTime.Now.ToLocalTime() + ": " +
                 "Call Status Event Handler Failed" +
                 " - Exception Source: " + e.Source + " - Exception Message: " + e.Message +
                 "\r\n");

            }

            try
            {
                // Try setting our custom event handler while avoiding any ambiguity.
                ((_ISkypeEvents_Event)skype).CallDtmfReceived += OurCallDtmfReceived;
            }
            catch (Exception e)
            {
            }
        }
Beispiel #56
0
        public SkypeBot(Main mainWindow, SBProperties sbproperties)
        {
            main = mainWindow;  //will this work backwords. If I change an aspect of main, will mainwindow be changed? I don't see why it would...
                                //but it does, so yay I guess.
                                //TODO: Ask Andre why.

            skype = new Skype();
            bool isrunning = false;
            do
            {
                if (skype.Client.IsRunning)
                {
                    skype.Attach(8, false);//TODO: skype attach causes hanging on consecutive runs, no idea why
                    isrunning = true;
                }
            } while (isrunning == false);

            skype.MessageStatus +=
              new _ISkypeEvents_MessageStatusEventHandler(skype_MessageStatus);
            sbprop = sbproperties;
            nick = sbprop._Account; //loads default value.

            #region commands
            List<string> com = new List<string>();
            com.Add("help");	//0
            com.Add("google");	//1
            com.Add("lmgtfy");	//2
            com.Add("date");	//3
            com.Add("time");	//4
            com.Add("coin");	//5
            com.Add("8ball");	//6
            com.Add("prgm");	//7
            com.Add("del");		//8
            com.Add("src");		//9
            com.Add("say");		//10
            com.Add("quote");	//11
            com.Add("wolfram");	//12
            com.Add("alpha");	//13
            com.Add("block");	//14
            com.Add("unblock");	//15
            com.Add("steam");	//16
            com.Add("bot");		//17
            com.Add("call");	//18
            commands = com.ToArray();
            #endregion

            instantiatePersonality("bot");
            refreshBlacklist();
        }
Beispiel #57
0
        private static void changeUserStatus(string desiredStatusString)
        {
            Skype skype = new Skype();

            TUserStatus status = skype.Convert.TextToUserStatus(desiredStatusString);

            if (status == TUserStatus.cusUnknown)
            {
                Console.WriteLine("{0} can not be converted to a skype user status", desiredStatusString);
                return;
            }

            Console.WriteLine("Changing user status to {0}...", status);
            skype.ChangeUserStatus(status);
        }
Beispiel #58
0
        private bool AttachAndConnectToSkype(Skype skype, bool firstStart)
        {
            if (!skype.Client.IsRunning)
            {
                // start with no splash screen
                skype.Client.Start(!firstStart, true);
            }

            // wait for the client to be ready for connection attempt, helps prevent Wait timeout error.

            if (firstStart)
            {
                System.Threading.Thread.Sleep(15000);
            }
            else
            {
                System.Threading.Thread.Sleep(5000);
            }

            try
            {
                AttachToSkype(skype);
            }

            //Handle various exceptions with a catch-all at the end
            catch (System.Runtime.InteropServices.COMException e)
            {
                if (String.Compare(e.Message.Trim(), "Not attached.") == 0)
                {
                    MessageBox.Show("Please verify that you are logged in to skype and click ok");

                }
                else if (String.Compare(e.Message.Trim(), "Wait timeout.") == 0)
                {
                    MessageBox.Show("Please check skype and allow program to connect and verify internet connection");
                }
                else
                {
                    MessageBox.Show("Unhandled error: " + e.Message.Trim());
                }

                return false;
            }

            return true;
        }
Beispiel #59
0
        public Form1()
        {
            InitializeComponent();

            _random = new LunaRandom();

            skype = new Skype();
            if (!skype.Client.IsRunning)
            {
                // start minimized with no splash screen
                skype.Client.Start(true, true);
            }

            // wait for the client to be connected and ready
            skype.Attach(8, true);

            skype.MessageStatus += new _ISkypeEvents_MessageStatusEventHandler(skype_MessageStatus);


            var files = Directory.GetFiles("Quotes", "*", SearchOption.AllDirectories).ToList();
            if (files.Count != 0)
            {
                foreach (var file in files)
                {
                    var strings = File.ReadAllLines(file);

                    var convertedStrings = new List<string>();
                    foreach (var s in strings)
                    {
                        convertedStrings.Add(s + " - " + Path.GetFileNameWithoutExtension(file));
                    }
                    ListOfAllQuotes.AddRange(convertedStrings);
                }
                
            }

            SetupCommandProcessors();

            _pulse = new System.Timers.Timer();
            _pulse.Elapsed += Pulse;
            _pulse.Interval = 1000; // in miliseconds
            _pulse.Start();

        }
        public MainWindow()
        {
            InitializeComponent();

            ActiveConferences = new ObservableCollection<Conference>();
            ActiveCalls = new ObservableCollection<Call>();
            KeyPresses = new ObservableCollection<string>();

            DataContext = this;
            HideOnMinimize.Enable(this);            

            _skype = new Skype();
            _skype.CallStatus += SkypeOnCallStatus;
            ((_ISkypeEvents_Event)_skype).AttachmentStatus += SkypeAttachmentStatus;
            _skype.Attach(SkypeProtocol, false);
            
            KeyboardHook.KeyPressed += OnKeyUp;
            KeyboardHook.SetHooks();
        }