Messaging fix: route messages destined to the logged-in username/callsign,
even before a position packet has been transmitted by that call. git-svn-id: http://repo.ham.fi/svn/aprsc/trunk@543 3ce903b1-3385-4e86-93cd-f9a4a239f7ac
This commit is contained in:
parent
dde8f88c3d
commit
26881bb247
|
|
@ -2340,11 +2340,15 @@ int filter_process(struct worker_t *self, struct client_t *c, struct pbuf_t *pb)
|
|||
* recently on the port, gate the message.
|
||||
*/
|
||||
if (c->flags & CLFLAGS_IGATE) {
|
||||
if ((pb->packettype & T_MESSAGE)
|
||||
&& client_heard_check(c, pb->dstname, pb->dstname_len)) {
|
||||
if (pb->packettype & T_MESSAGE) {
|
||||
if (
|
||||
(pb->dstname_len == c->username_len && memcmp(pb->dstname, c->username, c->username_len) == 0)
|
||||
|| (client_heard_check(c, pb->dstname, pb->dstname_len))
|
||||
) {
|
||||
/* insert the source callsign to the courtesy position list */
|
||||
client_courtesy_update(c, pb);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/* Courtesy position: if a message from this source callsign has been
|
||||
* passed to this socket within 30 minutes, do pass on the next
|
||||
|
|
|
|||
|
|
@ -298,6 +298,8 @@ void http_upload_position(struct evhttp_request *r, char *remote_host)
|
|||
#else
|
||||
http_pseudoclient->username = username;
|
||||
#endif
|
||||
http_pseudoclient->username_len = strlen(http_pseudoclient->username);
|
||||
|
||||
/* ok, try to digest the packet */
|
||||
e = incoming_parse(http_worker, http_pseudoclient, packet, end-packet);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ int login_handler(struct worker_t *self, struct client_t *c, int l4proto, char *
|
|||
strncpy(c->username, username, sizeof(c->username));
|
||||
c->username[sizeof(c->username)-1] = 0;
|
||||
#endif
|
||||
c->username_len = strlen(c->username);
|
||||
|
||||
c->handler = &incoming_handler; /* handler of all incoming APRS-IS data during a connection */
|
||||
if (c->flags & CLFLAGS_UPLINKSIM)
|
||||
c->handler = &incoming_uplinksim_handler;
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ int make_uplink(struct uplink_config_t *l)
|
|||
strncpy(c->username, mycall, sizeof(c->username));
|
||||
c->username[sizeof(c->username)-1] = 0;
|
||||
#endif
|
||||
|
||||
c->username_len = strlen(c->username);
|
||||
|
||||
/* These peer/sock name calls can not fail -- or the socket closed
|
||||
on us in which case it gets abandoned a bit further below. */
|
||||
|
|
|
|||
|
|
@ -275,12 +275,14 @@ struct client_t {
|
|||
CStateEnum state; /* state of the client... one of CSTATE_* */
|
||||
char warned; /* the client has been warned that it has bad filter definition */
|
||||
char validated; /* did the client provide a valid passcode */
|
||||
char username_len; /* length of user name */
|
||||
|
||||
#ifndef FIXED_IOBUFS
|
||||
char *username; /* The callsign */
|
||||
char *app_name; /* application name, from 'user' command */
|
||||
char *app_version; /* application version, from 'user' command */
|
||||
#endif
|
||||
|
||||
|
||||
/* the current handler function for incoming lines */
|
||||
int (*handler) (struct worker_t *self, struct client_t *c, int l4proto, char *s, int len);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#
|
||||
|
||||
use Test;
|
||||
BEGIN { plan tests => 8 + 9 + 1 + 2 + 2 + 6 + 4 };
|
||||
BEGIN { plan tests => 8 + 9 + 1 + 2 + 2 + 1 + 6 + 4 };
|
||||
use runproduct;
|
||||
use istest;
|
||||
use Ham::APRS::IS;
|
||||
|
|
@ -128,6 +128,14 @@ istest::should_drop(\&ok, $i_tx, $i_rx, $tx, $helper);
|
|||
$rx = $tx = "$msg_src>APRS,TCPIP*,qAC,$msg_src:!5528.51N/00505.68E# should pass TCPIP*";
|
||||
istest::txrx(\&ok, $i_rx, $i_tx, $tx, $rx);
|
||||
|
||||
#
|
||||
# Message to the client's callsign
|
||||
#
|
||||
|
||||
$tx = sprintf("$msg_src>APRS,OH2RDG*,WIDE,%s,I::%-9.9s:message", $login_tx, $login_rx);
|
||||
$rx = sprintf("$msg_src>APRS,OH2RDG*,WIDE,qAR,%s::%-9.9s:message", $login_tx, $login_rx);
|
||||
istest::txrx(\&ok, $i_tx, $i_rx, $tx, $rx);
|
||||
|
||||
#
|
||||
# Message to an OBJECT
|
||||
#
|
||||
|
|
|
|||
Loading…
Reference in New Issue