summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2020-03-28 04:33:26 +0300
committerdefanor <defanor@uberspace.net>2020-03-28 04:33:26 +0300
commit3869cb3f33d2694fa94b7a6d45b52c9a7568a2a2 (patch)
tree48069a6acf7ba18155f51a6bac84636fc0d7d4f2
parent8c621b46145e07e3eb3515a58f44ae6cd62caf0d (diff)
Check "from" on roster push
-rw-r--r--README11
-rw-r--r--src/rexmpp.c13
2 files changed, 18 insertions, 6 deletions
diff --git a/README b/README
index badd92e..fd1723f 100644
--- a/README
+++ b/README
@@ -54,14 +54,15 @@ A rough roadmap:
[ ] Separate states for server-to-client and client-to-server streams?
-- Primary IM features (?):
+- Primary IM features:
-[.] XMPP IM (RFC 6121): loading and managing of the roster and
- presence subscriptions. Optional roster management (loading and
- updates on roster push, with versioning) is implemented.
+[.] XMPP IM (RFC 6121): loading and managing of the roster, possibly
+ keeping track of contact presences. Optional roster management
+ (loading and updates on roster push, with versioning) is
+ implemented.
-- Common and reliable IM features (?):
+- Common and reliable IM features:
[.] XEP-0030: Service Discovery (implemented partially, just to
discover server features)
diff --git a/src/rexmpp.c b/src/rexmpp.c
index fe04481..d2d3dd8 100644
--- a/src/rexmpp.c
+++ b/src/rexmpp.c
@@ -1204,7 +1204,18 @@ void rexmpp_process_element (rexmpp_t *s) {
/* IQ "set" requests. */
if (strcmp(type, "set") == 0) {
xmlNodePtr query = xmlFirstElementChild(elem);
- if (s->manage_roster &&
+ int from_server = 0;
+ char *from = xmlGetProp(elem, "from");
+ if (from == NULL) {
+ from_server = 1;
+ } else {
+ if (strcmp(from, jid_bare_to_host(s->assigned_jid)) == 0) {
+ from_server = 1;
+ }
+ free(from);
+ }
+ if (from_server &&
+ s->manage_roster &&
rexmpp_xml_match(query, "jabber:iq:roster", "query")) {
/* Roster push. */
if (s->roster_ver != NULL) {