Ejemplo n.º 1
0
        /// <summary>
        /// Constructor with a single emoticon supplied.
        /// </summary>
        /// <param name="emoticon"></param>
        /// <param name="type"></param>
        public EmoticonMessage(Emoticon emoticon, EmoticonType type)
        {
            if (null == emoticon)
                throw new ArgumentNullException("emoticon");

            emoticons = new List<Emoticon>();
            emoticons.Add(emoticon);
            emoticontype = type;
        }
Ejemplo n.º 2
0
        protected internal virtual void SendEmoticonDefinitions(Contact remoteContact, List<Emoticon> emoticons, EmoticonType icontype)
        {
            EmoticonMessage emoticonMessage = new EmoticonMessage(emoticons, icontype);

            string to = ((int)remoteContact.ClientType).ToString() + ":" + remoteContact.Account;
            string from = ((int)Owner.ClientType).ToString() + ":" + Owner.Account;

            MultiMimeMessage mmMessage = new MultiMimeMessage(to, from);
            mmMessage.RoutingHeaders[MIMERoutingHeaders.From][MIMERoutingHeaders.EPID] = MachineGuid.ToString("B").ToLowerInvariant();

            mmMessage.ContentKeyVersion = "2.0";

            mmMessage.ContentHeaders[MIMEContentHeaders.MessageType] = MessageTypes.CustomEmoticon;
            mmMessage.ContentHeaders[MIMEContentHeaders.ContentType] = icontype == EmoticonType.AnimEmoticon ? "text/x-mms-animemoticon" : "text/x-mms-emoticon";
            mmMessage.InnerBody = emoticonMessage.GetBytes();

            NSMessage sdgPayload = new NSMessage("SDG");
            sdgPayload.InnerMessage = mmMessage;
            MessageProcessor.SendMessage(sdgPayload);
        }
Ejemplo n.º 3
0
        public HipchatGetAllEmoticonsResponse GetAllEmoticons(int startIndex = 0, int maxResults = 100, EmoticonType type = EmoticonType.All)
        {
            using (JsonSerializerConfigScope())
            {
                try
                {
                    return HipchatEndpoints.GetAllEmoticonsEndpoint
                        .AddHipchatAuthentication(_authToken)
                        .AddQueryParam("start-index", startIndex)
                        .AddQueryParam("max-results", maxResults)
                        .AddQueryParam("type", type)
                        .GetJsonFromUrl()
                        .FromJson<HipchatGetAllEmoticonsResponse>();
                }
                catch (Exception exception)
                {
                    if (exception is WebException)
                        throw ExceptionHelpers.WebExceptionHelper(exception as WebException, "view_group");

                    throw ExceptionHelpers.GeneralExceptionHelper(exception, "GetAllEmoticons");
                }
            }
        }
Ejemplo n.º 4
0
        public void SendEmoticonDefinitions(List<Emoticon> emoticons, EmoticonType icontype)
        {
            if (emoticons == null)
                throw new ArgumentNullException("emoticons");

            foreach (Emoticon emoticon in emoticons)
            {
                if (!NSMessageHandler.Owner.Emoticons.ContainsKey(emoticon.Sha))
                {
                    // Add the emotions to owner's emoticon collection.
                    NSMessageHandler.Owner.Emoticons.Add(emoticon.Sha, emoticon);
                }
            }

            if (CanReceiveMessage)
                NSMessageHandler.SendEmoticonDefinitions(this, emoticons, icontype);
        }
Ejemplo n.º 5
0
 public void SendEmoticonDefinitions(Contact contact, List<Emoticon> emoticons, EmoticonType icontype)
 {
     contact.SendEmoticonDefinitions(emoticons, icontype);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructor with multiple emoticons supplied.
 /// </summary>
 /// <param name="emoticons"></param>
 /// <param name="type"></param>
 public EmoticonMessage(List<Emoticon> emoticons, EmoticonType type)
 {
     Emoticons = new List<Emoticon>(emoticons);
     emoticontype = type;
 }
Ejemplo n.º 7
0
 public void SendEmoticonDefinitions(Contact remote, List<Emoticon> emoticons, EmoticonType icontype)
 {
     remote.SendEmoticonDefinitions(emoticons, icontype);
 }