Пример #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;
  }
Пример #2
0
 private void denyAuth(Protocol protocol, Message message, boolean isSystem) {
   if (isSystem) {
     SystemNotice notice = (SystemNotice) message;
     if (SystemNotice.SYS_NOTICE_AUTHREQ == notice.getSysnoteType()) {
       protocol.autoDenyAuth(message.getSndrUin());
     }
   }
 }