Exemple #1
0
        public bool addSource(IChatSource newSource)
        {
            if (!chatSources.ContainsKey(newSource.SourceName))
            {
                chatSources.Add(newSource.SourceName.ToUpper(), newSource);
                newSource.IncomingMessage += new IncomingMessageEventHandler(newSource_IncomingMessage);

                if (MainUser != null)
                {
                    //Assume that either there is only either none or at least one user account
                    if (MainUser.retrieve(newSource) == null)
                    {
                        UserAccount masterAccount;
                        if (MainUser.Profile != null)
                        {
                            masterAccount = newSource.createUser(MainUser.Profile.Name);
                        }
                        else
                        {
                            masterAccount = newSource.createUser("Boss");
                        }
                    }
                    else
                    {
                        newSource.setup(MainUser.retrieve(newSource)[0]);
                    }
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        public void send(ChatSourceMessage message)
        {
            IList <UserAccount> accounts = MainUser.retrieve(message.Source);

            if (accounts != null && accounts.Count > 0)
            {
                message.Source.send(message.Message, accounts[0]);
            }
        }