4 typedef long unsigned int size_t;
5 template<typename> class allocator;
6 template<class _CharT> struct char_traits;
7 template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_string;
8 typedef basic_string<char> string;
10 namespace std __attribute__ ((__visibility__ ("default"))) {
12 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
14 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
15 template<typename _Tp> class new_allocator {
18 namespace std __attribute__ ((__visibility__ ("default"))) {
19 template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> {
21 template<typename _Tp1> struct rebind {
22 typedef allocator<_Tp1> other;
28 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
30 namespace std __attribute__ ((__visibility__ ("default"))) {
31 template<typename _CharT, typename _Traits, typename _Alloc> class basic_string {
32 struct _Alloc_hider : _Alloc {
33 _Alloc_hider(_CharT* __dat, const _Alloc& __a) : _Alloc(__a), _M_p(__dat) {
37 mutable _Alloc_hider _M_dataplus;
39 basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
41 template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) {
46 namespace std __attribute__ ((__visibility__ ("default"))) {
48 struct _List_node_base {
49 _List_node_base* _M_next;
52 template<typename _Tp> struct _List_node : public __detail::_List_node_base {
54 template<typename _Tp> struct _List_iterator {
55 typedef _List_iterator<_Tp> _Self;
56 typedef _Tp& reference;
57 reference operator*() const {
59 bool operator!=(const _Self& __x) const {
62 template<typename _Tp, typename _Alloc> class _List_base {
64 typedef typename _Alloc::template rebind<_List_node<_Tp> >::other _Node_alloc_type;
65 struct _List_impl : public _Node_alloc_type {
66 __detail::_List_node_base _M_node;
67 _List_impl() : _Node_alloc_type(), _M_node() {
69 _List_impl(const _Node_alloc_type& __a) : _Node_alloc_type(__a), _M_node() {
77 template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class list : protected _List_base<_Tp, _Alloc> {
78 typedef _List_iterator<_Tp> iterator;
79 typedef size_t size_type;
87 size_type size() const {
89 void swap(list& __x) {
91 template<typename _StrictWeakOrdering> void merge(list& __x, _StrictWeakOrdering __comp);
92 template<typename _StrictWeakOrdering> void sort(_StrictWeakOrdering);
94 template<typename _Tp, typename _Alloc> template <typename _StrictWeakOrdering> void list<_Tp, _Alloc>:: merge(list& __x, _StrictWeakOrdering __comp) {
96 iterator __first1 = begin();
97 iterator __last1 = end();
98 iterator __first2 = __x.begin();
99 iterator __last2 = __x.end();
100 while (__first1 != __last1 && __first2 != __last2) if (__comp(*__first2, *__first1)) {
101 iterator __next = __first2;
106 template<typename _Tp, typename _Alloc> template <typename _StrictWeakOrdering> void list<_Tp, _Alloc>:: sort(_StrictWeakOrdering __comp) {
107 if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node) {
110 list * __fill = &__tmp[0];
113 for(__counter = &__tmp[0];
114 __counter != __fill && !__counter->empty();
115 ++__counter) { __counter->merge(__carry, __comp); __carry.swap(*__counter); }
118 for (__counter = &__tmp[1];
120 ++__counter) __counter->merge(*(__counter - 1), __comp);
127 class StanzaExtension {
132 using namespace gloox;
133 class AbstractPurpleRequest {
135 class AdhocCommandHandler : public AbstractPurpleRequest {
137 class AdhocTag : public Tag {
139 class AbstractConfigInterfaceHandler {
142 class DataFormField {
144 const std::string& value() const {
147 class DataFormFieldContainer {
149 bool hasField( const std::string& field ) const {
151 DataFormField* field( const std::string& field ) const;
153 class DataForm : public StanzaExtension, public DataFormFieldContainer {
157 SORT_BY_JID, SORT_BY_UIN, SORT_BY_BUDDIES, };
161 std::list<SortData> output;
164 class AdhocAdmin : public AdhocCommandHandler, public AbstractConfigInterfaceHandler {
165 AdhocTag *handleAdhocTag(Tag *stanzaTag);
166 AdhocTag *handleUnregisterUserForm(Tag *tag, const DataForm &form);
167 AdhocTag *handleListUsersForm(Tag *tag, const DataForm &form);
168 ListData m_listUsersData;
172 static bool compareIDataASC(SortData &a, SortData &b) {
174 AdhocTag *AdhocAdmin::handleListUsersForm(Tag *tag, const DataForm &form) {
175 ListData &data = m_listUsersData;
176 if (data.output.size() == 0) {
177 if (!form.hasField("users_vip") || !form.hasField("show_jid") || !form.hasField("show_uin") || !form.hasField("show_buddies") || !form.hasField("show_sort_by") || !form.hasField("show_sort_order") || !form.hasField("show_max_per_page") ) {
179 bool sort_asc = form.field("show_sort_order")->value() == "asc";
180 if (data.sort_by == SORT_BY_BUDDIES) {
181 if (sort_asc) data.output.sort(compareIDataASC);