Created XMPP context and better features parser
[cascardo/chat.git] / xmpp.c
diff --git a/xmpp.c b/xmpp.c
new file mode 100644 (file)
index 0000000..f42c55c
--- /dev/null
+++ b/xmpp.c
@@ -0,0 +1,80 @@
+/*
+ *  Copyright (C) 2008  Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+
+#include <stdlib.h>
+#include "xmpp.h"
+#include "xmpp_internal.h"
+
+hc_xmpp_t *
+hc_xmpp_new (void)
+{
+  hc_xmpp_t *xmpp = malloc (sizeof (hc_xmpp_t));
+  xmpp->tls = NONE;
+  xmpp->sasl = NONE;
+  return xmpp;
+}
+
+int
+hc_xmpp_is_tls_supported (hc_xmpp_t *xmpp)
+{
+  return xmpp->tls & SUPPORTED;
+}
+
+int
+hc_xmpp_is_tls_required (hc_xmpp_t *xmpp)
+{
+  return xmpp->tls & REQUIRED;
+}
+
+int
+hc_xmpp_is_tls_optional (hc_xmpp_t *xmpp)
+{
+  return xmpp->tls & OPTIONAL;
+}
+
+int
+hc_xmpp_is_tls_enabled (hc_xmpp_t *xmpp)
+{
+  return xmpp->tls & ENABLED;
+}
+
+int
+hc_xmpp_is_sasl_supported (hc_xmpp_t *xmpp)
+{
+  return xmpp->sasl & SUPPORTED;
+}
+
+int
+hc_xmpp_is_sasl_required (hc_xmpp_t *xmpp)
+{
+  return xmpp->sasl & REQUIRED;
+}
+
+int
+hc_xmpp_is_sasl_optional (hc_xmpp_t *xmpp)
+{
+  return xmpp->sasl & OPTIONAL;
+}
+
+int
+hc_xmpp_is_sasl_enabled (hc_xmpp_t *xmpp)
+{
+  return xmpp->sasl & ENABLED;
+}
+