Exemplo n.º 1
0
        private static void categoryHasItemsEvent(ArrayList items, string keyword)
        {
            ArrayList newItems = updateDatabaseTable(items, keyword);

            DAL.Select q = new DAL.Select("channel_name");
            q.addJoin("channelwatchers", DAL.Select.JoinTypes.Inner,
                      new DAL.WhereConds(false, "watcher_id", "=", false, "cw_watcher"));
            q.addJoin("channel", DAL.Select.JoinTypes.Inner,
                      new DAL.WhereConds(false, "channel_id", "=", false, "cw_channel"));
            q.setFrom("watcher");
            q.addWhere(new DAL.WhereConds("watcher_keyword", keyword));
            q.addLimit(10, 0);

            ArrayList channels = DAL.singleton().executeSelect(q);

            foreach (object[] item in channels)
            {
                string channel = (string)item[0];

                string message = compileMessage(items, keyword, channel, false);
                if (Configuration.singleton()["silence", channel] == "false")
                {
                    Helpmebot6.irc.ircPrivmsg(channel, message);
                }
            }

            if (newItems.Count > 0)
            {
                var message = compileMessage(newItems, keyword, ">TWITTER<", false);

                new Twitter().updateStatus(message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Determines whether [is watcher in channel] [the specified channel].
        /// </summary>
        /// <param name="channel">The channel.</param>
        /// <param name="keyword">The keyword.</param>
        /// <returns>
        ///     <c>true</c> if [is watcher in channel] [the specified channel]; otherwise, <c>false</c>.
        /// </returns>
        public bool isWatcherInChannel(string channel, string keyword)
        {
            DAL.Select q = new DAL.Select("COUNT(*)");
            q.setFrom("channelwatchers");
            q.addWhere(new DAL.WhereConds("channel_name", channel));
            q.addWhere(new DAL.WhereConds("watcher_keyword", keyword));
            q.addJoin("channel", DAL.Select.JoinTypes.Inner,
                      new DAL.WhereConds(false, "cw_channel", "=", false, "channel_id"));
            q.addJoin("watcher", DAL.Select.JoinTypes.Inner,
                      new DAL.WhereConds(false, "cw_watcher", "=", false, "watcher_id"));

            string count = DAL.singleton().executeScalarSelect(q);

            if (count == "0")
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 3
0
        private static void categoryHasItemsEvent(ArrayList items, string keyword)
        {
            ArrayList newItems = updateDatabaseTable(items, keyword);

            DAL.Select q = new DAL.Select("channel_name");
            q.addJoin("channelwatchers", DAL.Select.JoinTypes.Inner,
                      new DAL.WhereConds(false, "watcher_id", "=", false, "cw_watcher"));
            q.addJoin("channel", DAL.Select.JoinTypes.Inner,
                      new DAL.WhereConds(false, "channel_id", "=", false, "cw_channel"));
            q.setFrom("watcher");
            q.addWhere(new DAL.WhereConds("watcher_keyword", keyword));
            q.addLimit(10, 0);

            ArrayList channels = DAL.singleton().executeSelect(q);
            foreach (object[] item in channels)
            {
                string channel = (string) item[0];

                string message = compileMessage(items, keyword, channel, false);
                if (Configuration.singleton()["silence",channel] == "false")
                    Helpmebot6.irc.ircPrivmsg(channel, message);
            }

            if (newItems.Count > 0)
              new Twitter(  ).updateStatus(compileMessage(newItems, keyword, ">TWITTER<", false));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Determines whether [is watcher in channel] [the specified channel].
        /// </summary>
        /// <param name="channel">The channel.</param>
        /// <param name="keyword">The keyword.</param>
        /// <returns>
        /// 	<c>true</c> if [is watcher in channel] [the specified channel]; otherwise, <c>false</c>.
        /// </returns>
        public bool isWatcherInChannel(string channel, string keyword)
        {
            DAL.Select q = new DAL.Select("COUNT(*)");
            q.setFrom("channelwatchers");
            q.addWhere(new DAL.WhereConds("channel_name", channel));
            q.addWhere(new DAL.WhereConds("watcher_keyword", keyword));
            q.addJoin("channel", DAL.Select.JoinTypes.Inner,
                      new DAL.WhereConds(false, "cw_channel", "=", false, "channel_id"));
            q.addJoin("watcher", DAL.Select.JoinTypes.Inner,
                      new DAL.WhereConds(false, "cw_watcher", "=", false, "watcher_id"));

            string count = DAL.singleton().executeScalarSelect(q);
            if (count == "0")
                return false;
            return true;
        }