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 void addSelector(String controlId, int label, String items, int index) {
   String[] all = Util.explode(items, '|');
   for (int i = 0; i < all.length; ++i) {
     all[i] = all[i];
   }
   addSelector(controlId, label, all, index);
 }
Exemple #3
0
 public void addSelector(String controlId, String label, String items, int index) {
   String[] all = Util.explode(items, '|');
   for (int i = 0; i < all.length; ++i) {
     all[i] = all[i];
   }
   Control c = create(controlId, CONTROL_SELECT, null, label);
   c.items = all;
   c.current = index % c.items.length;
   add(c);
 }
Exemple #4
0
 private boolean containsKeywords(String msg) {
   String opt = Options.getString(JLocale.getString(R.string.pref_antispam_keywords));
   if (0 == opt.length()) return false;
   if (5000 < msg.length()) {
     return true;
   }
   String[] keywords = Util.explode(opt.toLowerCase(), ' ');
   msg = msg.toLowerCase();
   for (int i = 0; i < keywords.length; ++i) {
     if (-1 != msg.indexOf(keywords[i])) {
       return true;
     }
   }
   return false;
 }