X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=features.c;h=a4427ceef30c6837f68b508c45e32d2182c37867;hb=baef3c66194214f38ab263a46722b6bd8b2fa156;hp=3fd1896ac36f8765886a02e931dfcdcba0e98f91;hpb=ded734abecf69e281222c987dc201586a46199e1;p=cascardo%2Fchat.git 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); } }