#include #include #include #include #include #include #include #include #include #include #include void StatusCallback(XMPPCommandManager *m, char *from, XMLElement *form, XMLElement *out, char *node) { char *trimmed = ParseeTrimJID(from); size_t alloc = MemoryAllocated(); size_t kb = alloc >> 10; size_t mb = kb >> 10; size_t gb = mb >> 10; size_t min = gb ? gb : (mb ? mb : (kb ? kb : alloc)); char *unit = gb ? "GB" : (mb ? "MB" : (kb ? "KB" : "B")); XMLElement *x; XMLElement *title, *txt; Free(trimmed); x = XMLCreateTag("x"); title = XMLCreateTag("title"); { XMLElement *title_text = XMLCreateText("Parsee statistics"); XMLAddChild(title, title_text); } XMLAddChild(x, title); XMLAddAttr(x, "xmlns", "jabber:x:data"); XMLAddAttr(x, "type", "result"); { XMLElement *reported, *item, *field, *value; reported = XMLCreateTag("reported"); XMLAddChild(x, reported); /* Report */ Report("mem-alloc", "Heap allocated with Cytoplasm"); Report("xml-congest", "Unprocessed stanzas(congestion)"); Report("uptime", "Parsee uptime"); /* Set */ BeginItem(); { char *min_str = StrInt(min); char *congest = StrInt(ParseeCongestion()); char *alloc = StrConcat(3, min_str, " ", unit); char *up = ParseeStringifyDate(ParseeUptime()); SetField("mem-alloc", alloc); SetField("xml-congest", congest); SetField("uptime", up); Free(congest); Free(min_str); Free(alloc); Free(up); } EndItem(); } XMLAddChild(out, x); (void) form; (void) node; (void) m; }