+/*
+ * 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 "xmpp_internal.h"
+#include "disco.h"
+
+void
+hc_xmpp_send_disco_info (hc_xmpp_t *xmpp, char *to)
+{
+ iks *disco;
+ iks *query;
+ disco = iks_new ("iq");
+ iks_insert_attrib (disco, "type", "get");
+ iks_insert_attrib (disco, "to", to);
+ query = iks_insert (disco, "query");
+ iks_insert_attrib (query, "xmlns", HC_XMPP_NS_DISCO_INFO);
+ hc_xmpp_send_iks (xmpp, disco);
+ iks_delete (disco);
+}
+
+void
+hc_xmpp_recv_disco (hc_xmpp_t *xmpp, iks *disco)
+{
+ char *ns = iks_find_attrib (iks_child (disco), "xmlns");
+ if (!iks_strcmp (ns, HC_XMPP_NS_DISCO_INFO))
+ {
+ iks *c;
+ for (c = iks_child (iks_child (disco)); c != NULL; c = iks_next (c))
+ {
+ fprintf (stdout, "%s\n", iks_find_attrib (c, "var"));
+ }
+ }
+}