Пример #1
0
        /// <summary>
        /// Method to handle the reception of a subscription request
        /// By Default returns false
        /// </summary>
        /// <param name="from">Jid from which the subscription request has arrived</param>
        /// <returns></returns>
        private bool SubScribeRequest(Jid from)
        {
            uiDispatcher.multiDebug("\n" + DateTime.Now + " | Subscription received by | " + from.ToString());

            return false;
        }
Пример #2
0
        /// <summary>
        /// Sends a File Object to the Person
        /// </summary>
        /// <param name="peer">Person to send the file object</param>
        /// <param name="moment2distr">File object to send</param>
        /// <returns>The Sid of the transfer, null if error</returns>
        public string SendFile(Jid peer, string moment2distr)
        {
            if ((moment2distr == null) || !isConnected()) return null;

            String fileName = System.IO.Path.GetFileName(moment2distr);
            String tempFilePath = Path.Combine(System.IO.Path.GetTempPath(), fileName);
            string sid;

            ///COPY MOMENT TO A TEMP DIR
            ///
            try
            {
                File.Copy(moment2distr, tempFilePath, true);
            }
            catch (DirectoryNotFoundException copyError)
            {
                uiDispatcher.multiDebug(copyError.Message);
            }
            catch (PathTooLongException copyError)
            {
                uiDispatcher.multiDebug(copyError.Message);
            }
            catch (UnauthorizedAccessException copyError)
            {
                uiDispatcher.multiDebug(copyError.Message);
            }
            catch (ArgumentException copyError)
            {
                uiDispatcher.multiDebug(copyError.Message);
            }
            catch (FileNotFoundException copyError)
            {
                uiDispatcher.multiDebug(copyError.Message);
            }
            catch (IOException copyError)
            {
                uiDispatcher.multiDebug(copyError.Message);
            }

            //The sid of the file transfer
            //Serialize with escaped characters the description of the moment
            string xdesc = new System.Xml.Linq.XText(moment2distr.ToString()).ToString();

            try
            {
                sid = xmppClient.InitiateFileTransfer(peer, tempFilePath, xdesc);
                return sid;
            }
            catch (Exception e)
            {
                uiDispatcher.multiDebug("Error in transfering moment" + e.StackTrace + e.ToString());
            }
            return null;
        }
Пример #3
0
 public void SendMessage(Jid jid, string message)
 {
     xmppClient.SendMessage(jid, message);
 }