ushahidi / SMSSync

SMS gateway for Android powered phones
http://smssync.ushahidi.com
GNU Lesser General Public License v3.0
1.13k stars 491 forks source link

Keywords are ignored when forwarding messages #378

Open alxndrsn opened 8 years ago

alxndrsn commented 8 years ago

In PostMessage.postMessage(Message message, SyncUrl syncUrl), the method appears it should be checking keywords before deciding if a message should be forwarded, but actually it always performs the same action. The code simplifies to:

private boolean postMessage(Message message, SyncUrl syncUrl) {
    if (a(message, syncUrl)) {
        if (b(message, syncUrl)) {
            return postToWebService(message, syncUrl);
        }
    }
    return postToWebService(message, syncUrl);
}

Regardless of the results of a() and b(), this method will always call postToWebService with the same arguments.


If this is deliberate, and the code does not rely on Exceptions being thrown in the a() and b() code, calls to postMessage(message, syncUrl) could be replaced with direct calls to postToWebService(message, syncUrl).

ghost commented 8 years ago

Is there an older version, where the keyword filtering functionality works?

AlfonsoML commented 7 years ago

So this is the reason why it doesn't work at all?

I want to setup two endpoints according to a keyword in the message received, and despite setting up the filter for each endpoint the message is POSTed to both URLs