This file is indexed.

/usr/include/licq/filter.h is in licq-dev 1.8.2-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
/*
 * This file is part of Licq, an instant messaging client for UNIX.
 * Copyright (C) 2011-2012 Licq developers <licq-dev@googlegroups.com>
 *
 * Licq is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Licq is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Licq; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef LICQ_FILTER_H
#define LICQ_FILTER_H

#include <boost/noncopyable.hpp>
#include <vector>
#include <string>

namespace Licq
{

/**
 * Data for a filter rule
 */
struct FilterRule
{
  // Rule will be ignore unless this is set
  bool isEnabled;

  // Protocol id to use rule for or zero for all protocols
  unsigned long protocolId;

  // Event types to apply this rule for
  unsigned long eventMask;

  // Regular expression to match with
  std::string expression;

  // Action to perform if rule matches
  enum ActionType
  {
    ActionAccept        = 1,
    ActionSilent        = 2,
    ActionIgnore        = 3,
  };
  int action;
};

typedef std::vector<FilterRule> FilterRules;

/**
 * Manager for event filter
 *
 * Incoming events are matched againts the list of filter rules before being
 * handled by Licq or forwarded to any plugins.
 * Events from contacts in list are always accepted
 * The first rule that matches is used
 * If no rule matches, the default action is to accept all events
 */
class FilterManager : private boost::noncopyable
{
public:
  /**
   * Get the list of filter rules
   *
   * @param rules List to populate with the currently active rules
   */
  virtual void getRules(FilterRules& rules) = 0;

  /**
   * Set filter rules
   *
   * @param newRules List of filter rules to make active
   */
  virtual void setRules(const FilterRules& newRules) = 0;

  /**
   * Get the list of default filter rules
   *
   * @param rules List to populate with the default rules
   */
  virtual void getDefaultRules(FilterRules& rules) = 0;

protected:
  virtual ~FilterManager() { /* Empty */ }
};

extern FilterManager& gFilterManager;

} // namespace Licq

#endif