[GH-ISSUE #378] Keywords are ignored when forwarding messages #273

Open
opened 2026-02-28 01:23:57 +03:00 by kerem · 2 comments
Owner

Originally created by @alxndrsn on GitHub (Apr 6, 2016).
Original GitHub issue: https://github.com/ushahidi/SMSSync/issues/378

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).

Originally created by @alxndrsn on GitHub (Apr 6, 2016). Original GitHub issue: https://github.com/ushahidi/SMSSync/issues/378 In [`PostMessage.postMessage(Message message, SyncUrl syncUrl)`](https://github.com/ushahidi/SMSSync/blob/a1f2224bbb4488a9772eb35a1d8648e0dc350a59/smssync/src/main/java/org/addhen/smssync/data/message/PostMessage.java#L318), 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)`.
Author
Owner

@ghost commented on GitHub (May 17, 2016):

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

<!-- gh-comment-id:219633214 --> @ghost commented on GitHub (May 17, 2016): Is there an older version, where the keyword filtering functionality works?
Author
Owner

@AlfonsoML commented on GitHub (Mar 3, 2017):

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

<!-- gh-comment-id:284022797 --> @AlfonsoML commented on GitHub (Mar 3, 2017): 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
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SMSSync#273
No description provided.