Search in sources :

Example 1 with ForumNewTopicSpammer

use of net.jforum.util.mail.ForumNewTopicSpammer in project jforum2 by rafaelsteil.

the class ForumCommon method notifyUsers.

/**
	 * Sends a "new topic" notification message to all users watching the forum.
	 * 
	 * @param f The Forum changed
	 * @param t The new topic
	 * @param post the newly created message
	 */
public static void notifyUsers(Forum f, Topic t, Post post) {
    if (SystemGlobals.getBoolValue(ConfigKeys.MAIL_NOTIFY_ANSWERS)) {
        try {
            ForumDAO dao = DataAccessDriver.getInstance().newForumDAO();
            List usersToNotify = dao.notifyUsers(f);
            // subscribed to the topic
            if (usersToNotify != null && usersToNotify.size() > 0) {
                Executor.execute(new EmailSenderTask(new ForumNewTopicSpammer(f, t, post, usersToNotify)));
            }
        } catch (Exception e) {
            logger.warn("Error while sending notification emails: " + e);
        }
    }
}
Also used : ForumDAO(net.jforum.dao.ForumDAO) ForumNewTopicSpammer(net.jforum.util.mail.ForumNewTopicSpammer) EmailSenderTask(net.jforum.util.mail.EmailSenderTask) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 ForumDAO (net.jforum.dao.ForumDAO)1 EmailSenderTask (net.jforum.util.mail.EmailSenderTask)1 ForumNewTopicSpammer (net.jforum.util.mail.ForumNewTopicSpammer)1