Exemple #1
0
  public boolean isSpamMessage(
      Protocol protocol, Message message, boolean isSystem, boolean isPlain) {
    if (!Options.getBoolean(JLocale.getString(R.string.pref_antispam_enable))) {
      return false;
    }
    String uin = message.getSndrUin();
    if (isChecked(uin)) {
      return false;
    }
    denyAuth(protocol, message, isSystem);
    if (!isPlain) {
      return true;
    }
    String msg = message.getText();
    if (msg.length() < 256) {
      // MagicEye.addAction(protocol, uin, "antispam", msg);
    }
    if (message.isOffline()) {
      return true;
    }
    Contact contact = protocol.createTempContact(uin, false);

    String[] msgs =
        Util.explode(Options.getString(JLocale.getString(R.string.pref_antispam_answer)), '\n');
    for (int i = 0; i < msgs.length; ++i) {
      if (msg.equalsIgnoreCase(msgs[i])) {
        sendHelloMessage(protocol, contact);
        return true;
      }
    }
    sendQuestion(protocol, contact);
    return true;
  }
Exemple #2
0
 public static boolean isSpam(
     Protocol protocol, Message message, boolean isSystem, boolean isPlain) {
   if (Options.getBoolean(JLocale.getString(R.string.pref_antispam_enable)))
     if (antiSpam.containsKeywords(message.getText())) {
       antiSpam.denyAuth(protocol, message, isSystem);
       return true;
     }
   return antiSpam.isSpamMessage(protocol, message, isSystem, isPlain);
 }