qksms
qksms copied to clipboard
Block by keyword
It would be the next great feature if you could implement block by keyword function on blocker feature. Block by keyword is filtering unknown incoming sms by a list of keyword defined by a user. Thank you.
I want it too!
I'm not really into android, it's a quick one hour hack. I had to update the build.gradle as per android studios suggestion otherwise builds failed. I also changed these files:
- java/com/moez/QKSMS/common/BlockedConversationHelper.java
- java/com/moez/QKSMS/enums/QKPreference.java
- java/com/moez/QKSMS/receiver/MessagingReceiver.java
- java/com/moez/QKSMS/ui/settings/SettingsFragment.java
- res/values/strings.xml
- res/xml/settings_general.xml
And added:
- java/com/moez/QKSMS/ui/dialog/BlockedRegexDialog.java
I removed INTERNET
permission entirely, me and my friends have a little obsession with sms stuff not leaking into net. It's not perfect but gets the job done.
The filter has a syntax:
- patterns like 'c: blabla' -> sms body checked against
blabla
, it text contains the phrase, the number is automatically added to blocked numbers, and the sms also goes into junk box. - patterns like 'r: .blabla.' ->
.*blabla.*
is compiled as a regex and the sms body is checked against it, if matches -> block and stuff, same as above.
Todo:
- Maybe a dedicated section for managing message block rules
- Two seperate section for contains, and regex matching. Or maybe a checkbox in front of it, any UX just better than this.
- Adding rule for not blocking numbers of specific length even if they match one of the rules (for me all the spam and junk messages are from 4 to 6 digit numbers, while the other numbers are of length 10)
I'm late for work already, gotta go. check my account you'll find the repo. have fun.
Well, I guess it was too developerish for my friends taste. I'm making it simpler: one option for regex, one for black listed words. If it turns out to be good I'd make a PR. if you have any suggestion for a better user experience do tell me please.
I'm excited, finally somebody care to implement this feature :) How can I tested?
well... I was in a hurry. Currently in the first run the app adds some persian words to the black list, but it'll be easy (and quicker, changed the list implementation) to remove them.
The Internet access is completely removed.
the complex syntax mentioned above is also removed. there's two menu options: add regex pattern, add blacklisted words.
apart from those, everything works as expected. You can find the code here: https://github.com/loolooyyyy/qksms
And a pre compiled apk here, you must remove the original qksms before! https://koosha.cc/sms.apk
Awesome. I'll try it, and hopefully a lot spam message will be filtered within the next week. I hope the blacklisted word is case insensitive. I'll get back to you soon. Thanks.
It is. the idea is to have language specific text preprocessors, toLowerCase for English, dummySpaceRemover for persian, ...
Currently there is 13 persian words. I cannot delete the persian word, and I cannot add more than 5 english words. So totally there's 18 words (persian and english). Every time I remove the persian words, it's reappear. And everytime I add another english word, it's dissapear.
that's strange. I'll try to fix it tonight.
@loolooyyyy, thanks for the effort, I always wanted to see this feature. I wish you'll make a pull request so that we'd get your changes upstream.
https://github.com/moezbhatti/qksms/pull/733
@loolooyyyy Great thanks for your work.
There's a lot of spam message from a sender start with number 1069
, I was wondering if we could configure QKSMS to make it in being read status and don't send any notification to Android system some day?

@liweijian That should already be the default behavior? if a message is identified as spam, then no notification is sent to user and the message is marked as read. This is also the case for the future messages from that sender even if they don't contain the spam words/patterns (the sender is permanently blocked on first occurrence of a spam message)
@loolooyyyy
Thanks for your reply.
I was wondering if maybe we could mark all the message prefix of 1069
as read automatically. Because the senders' number change all the time. For example, futu5 would send sms to me using 10691111
today, but they will use 10692222
tomorrow.
I thought regex pattern matching and word blacklisting would be a good solution for ***holes keep changing their number, because the messages usually follow the same pattern and have similar words. But why not? let's do it.
edit: I just realized the characters in screensshot have totally changed. Number prefix blocking seems the only solution.
@liweijian done. please test.
Currently there is 13 persian words. I cannot delete the persian word, and I cannot add more than 5 english words. So totally there's 18 words (persian and english). Every time I remove the persian words, it's reappear. And everytime I add another english word, it's dissapear.
@loolooyyyy, have you checked it yet?
@bleketux sure, persian words removed, and the list works as expected. I tested up to 40 words and 10 patterns. What is your android version?
P.S: a pre-compiled version is at https://koosha.cc/sms.apk but the internet access is removed so no internet related service would work (jabber and stuff).
It work great. Thanks.
I wonder, is it work if filtering part of the word?
for example:
if I add "card" to word list, then if I receive a message containing "creditcard", it will be considered as spam, right? or should I add "*card*
"?.
btw, my android version is 6.0, using huawei emui 4.0
For the word blacklist option, It's a simple java's String.contains(yourWord). The quotes are just to make it clear, don't put quotes around the word in the app.
"card"
(notice there is NO spaces around the word):
- Matches
you won a free card come and get it
. - Also matches match
your creditcard will expire in 3 days
Not good! we don't want this to happen!
" card "
(notice the spaces around the word):
- Matches
you won a free card come and get it
. - Does NOT match
your creditcard will expire in 3 days
. Better.
I just realized it won't match card!
(with the exclamation mark), because we added space
s around the word. So you won a free card! come and get it
won't be matched. Not so good. What I'm going to do is to check for word boundary instead, so card
and card!
or even card,
will match but creditcard
won't match.
For full control over filtering, you can resort to pattern matching. It follows Java regex rules (it is actually java regex): https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html It can get complicated for non technical users or worse, a mistake can cause all messages to be blocked though!
@loolooyyyy Great thanks
Hmm, maybe not only with exclamation mark, I got a message like this: you can buy using cash/card at blabla
and it won't match. (yes, there's no spaces around the word "card"
)
I know that it's not good to match part of the word. If I want to do it, I have to use regex pattern right? Since I'm not that technical, please provide me regex sample to match part of the word. Thanks.
And, is it possible to add a trigger (a button maybe) to rerun our new added block rules through all message? hehe sorry for asking to much request :smile:
It's great that you guys are modifying the app to have a workaround for yourselves!
I don't plan on adding this feature in the public version of QKSMS however, so I'm going to be closing the issue
Oh no... :( but wait... you said public version, is there any other version that going to implement this feature? ;)
@bleketux by that I meant that you're welcome to implement it yourself! but I do not plan on contributing to it. sorry about that!
I've changed my mind about implementing this, thought about it some more and I think that it would be really great for specific use cases
Great news... thanks... 🥇 😄
it would be really great for specific use cases
@moezbhatti YES, IT IS. For example, friends or family members that always nag you about a particular topic. You obviously don't want to completely shut them out, you just want to not be notified and bothered when they bring specific things up.
I've been checking various Android SMS apps, the only decent apps I found that have this are EvolveSMS and Go SMS Pro.
Evolve is kind of okay but the dev has 2 SMS apps and they focus on the other one more (Pulse SMS). I don't like Go. If you finally add this to QK that would be absolutely great.
@moezbhatti You lead the project so the cards are in your hands ;) But any chance that this functionality will be implemented soon? About the fork of @loolooyyyy I can't do it nor judging the quality of coding, but what is your point of view? The pull is not OK for you?
@loolooyyyy Hey sir, can you make your package works as this: "Block message, no sound alert, but still have a special info on statusbar"
Cause most annoying SMS is sent by useful company, I would check if there would be some important message got blocked by accident.