+ if (strcasecmp ("N/A", str_ptr) == 0)
+ value = -1;
+ else
+ {
+ char *end_ptr = NULL;
+ value = strtol (str_ptr, &end_ptr, 0);
+ if (str_ptr == end_ptr)
+ {
+ xmlFree(str_ptr);
+ ERROR ("ascent plugin: ascent_xml_read_int: strtol failed.");
+ return (-1);
+ }
+ }
+ xmlFree(str_ptr);
+
+ *ret_value = value;
+ return (0);
+} /* }}} int ascent_xml_read_int */
+
+static int ascent_xml_sessions_plr (xmlDoc *doc, xmlNode *node, /* {{{ */
+ player_info_t *pi)
+{
+ xmlNode *child;
+
+ for (child = node->xmlChildrenNode; child != NULL; child = child->next)
+ {
+ if ((xmlStrcmp ((const xmlChar *) "comment", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "text", child->name) == 0))
+ /* ignore */;
+ else if (xmlStrcmp ((const xmlChar *) "race", child->name) == 0)
+ ascent_xml_read_int (doc, child, &pi->race);
+ else if (xmlStrcmp ((const xmlChar *) "class", child->name) == 0)
+ ascent_xml_read_int (doc, child, &pi->class);
+ else if (xmlStrcmp ((const xmlChar *) "gender", child->name) == 0)
+ ascent_xml_read_int (doc, child, &pi->gender);
+ else if (xmlStrcmp ((const xmlChar *) "level", child->name) == 0)
+ ascent_xml_read_int (doc, child, &pi->level);
+ else if (xmlStrcmp ((const xmlChar *) "latency", child->name) == 0)
+ ascent_xml_read_int (doc, child, &pi->latency);
+ else if ((xmlStrcmp ((const xmlChar *) "name", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "pvprank", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "map", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "areaid", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "xpos", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "ypos", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "onime", child->name) == 0))
+ /* ignore */;
+ else
+ {
+ WARNING ("ascent plugin: ascent_xml_status: Unknown tag: %s", child->name);
+ }
+ } /* for (child) */
+
+ return (0);
+} /* }}} int ascent_xml_sessions_plr */
+
+static int ascent_xml_sessions (xmlDoc *doc, xmlNode *node) /* {{{ */
+{
+ xmlNode *child;
+ player_stats_t ps;
+
+ memset (&ps, 0, sizeof (ps));
+
+ for (child = node->xmlChildrenNode; child != NULL; child = child->next)
+ {
+ if ((xmlStrcmp ((const xmlChar *) "comment", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "text", child->name) == 0))
+ /* ignore */;
+ else if (xmlStrcmp ((const xmlChar *) "plr", child->name) == 0)
+ {
+ int status;
+ player_info_t pi = PLAYER_INFO_STATIC_INIT;
+
+ status = ascent_xml_sessions_plr (doc, child, &pi);
+ if (status == 0)
+ ascent_account_player (&ps, &pi);
+ }
+ else
+ {
+ WARNING ("ascent plugin: ascent_xml_status: Unknown tag: %s", child->name);
+ }
+ } /* for (child) */
+
+ ascent_submit_players (&ps);
+
+ return (0);
+} /* }}} int ascent_xml_sessions */