X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fhcxmpp.git;a=blobdiff_plain;f=features.c;h=a4427ceef30c6837f68b508c45e32d2182c37867;hp=3fd1896ac36f8765886a02e931dfcdcba0e98f91;hb=8729c58972d65ab4b4b7ef3da9bcaf0d7f237d4c;hpb=fee0c9537ee0b8dc497fd789d0c20e5db09766a8 diff --git a/features.c b/features.c index 3fd1896..a4427ce 100644 --- a/features.c +++ b/features.c @@ -19,7 +19,35 @@ #include "xmpp_internal.h" -void +static void +session (hc_xmpp_t *xmpp, iks *f) +{ + iks *c; + xmpp->session |= SUPPORTED; + for (c = iks_child (f); c != NULL; c = iks_next (c)) + { + if (!iks_strcmp (iks_name (c), "optional")) + xmpp->session |= OPTIONAL; + else if (!iks_strcmp (iks_name (c), "required")) + xmpp->session |= REQUIRED; + } +} + +static void +xmpp_bind (hc_xmpp_t *xmpp, iks *f) +{ + iks *c; + xmpp->bind |= SUPPORTED; + for (c = iks_child (f); c != NULL; c = iks_next (c)) + { + if (!iks_strcmp (iks_name (c), "optional")) + xmpp->bind |= OPTIONAL; + else if (!iks_strcmp (iks_name (c), "required")) + xmpp->bind |= REQUIRED; + } +} + +static void sasl (hc_xmpp_t *xmpp, iks *f) { iks *c; @@ -33,7 +61,7 @@ sasl (hc_xmpp_t *xmpp, iks *f) } } -void +static void tls (hc_xmpp_t *xmpp, iks *f) { iks *c; @@ -56,8 +84,14 @@ hc_xmpp_features (hc_xmpp_t *xmpp, iks *features) if (!iks_strcmp (iks_name (c), "starttls") && !iks_strcmp (iks_find_attrib (c, "xmlns"), HC_XMPP_NS_TLS)) tls (xmpp, c); - if (!iks_strcmp (iks_name (c), "mechanisms") && + else if (!iks_strcmp (iks_name (c), "mechanisms") && !iks_strcmp (iks_find_attrib (c, "xmlns"), HC_XMPP_NS_SASL)) sasl (xmpp, c); + else if (!iks_strcmp (iks_name (c), "bind") && + !iks_strcmp (iks_find_attrib (c, "xmlns"), HC_XMPP_NS_BIND)) + xmpp_bind (xmpp, c); + else if (!iks_strcmp (iks_name (c), "session") && + !iks_strcmp (iks_find_attrib (c, "xmlns"), HC_XMPP_NS_SESSION)) + session (xmpp, c); } }