Works on the principle account_get_commandgroups. here's the code in "haste arm":
static int _handle_cgonline_command(t_connection * c, char const *text)
{
unsigned int i;
t_elem const * curr;
t_connection * tc;
char const * nick;
t_channel * channel;
channel = conn_get_channel(c);
std::strcpy(msgtemp, "Admins command group's:");
i = std::strlen(msgtemp);
LIST_TRAVERSE_CONST(connlist(), curr)
{
tc = (t_connection*)elem_get_data(curr);
if (!tc)
continue;
if (!conn_get_account(tc))
continue;
if (account_get_command_groups(conn_get_account(tc)) == 255)
if ((nick = conn_get_username(tc)))
{
if (i + std::strlen(nick) + 2>sizeof(msgtemp)) /* " ", name, '\0' */
{
message_send_text(c, message_type_info, c, msgtemp);
i = 0;
}
std::sprintf(&msgtemp[i], " %s [12345678] ", nick);
i += std::strlen(&msgtemp[i]);
}
if (account_get_command_groups(conn_get_account(tc)) == 64)
if ((nick = conn_get_username(tc)))
{
if (i + std::strlen(nick) + 2>sizeof(msgtemp)) /* " ", name, '\0' */
{
message_send_text(c, message_type_info, c, msgtemp);
i = 0;
}
std::sprintf(&msgtemp[i], " %s [1234567] ", nick);
i += std::strlen(&msgtemp[i]);
}
if (account_get_command_groups(conn_get_account(tc)) == 32)
if ((nick = conn_get_username(tc)))
{
if (i + std::strlen(nick) + 2>sizeof(msgtemp)) /* " ", name, '\0' */
{
message_send_text(c, message_type_info, c, msgtemp);
i = 0;
}
std::sprintf(&msgtemp[i], " %s [123456] ", nick);
i += std::strlen(&msgtemp[i]);
}
if (account_get_command_groups(conn_get_account(tc)) == 16)
if ((nick = conn_get_username(tc)))
{
if (i + std::strlen(nick) + 2>sizeof(msgtemp)) /* " ", name, '\0' */
{
message_send_text(c, message_type_info, c, msgtemp);
i = 0;
}
std::sprintf(&msgtemp[i], " %s [12345] ", nick);
i += std::strlen(&msgtemp[i]);
}
if (account_get_command_groups(conn_get_account(tc)) == 8)
if ((nick = conn_get_username(tc)))
{
if (i + std::strlen(nick) + 2>sizeof(msgtemp)) /* " ", name, '\0' */
{
message_send_text(c, message_type_info, c, msgtemp);
i = 0;
}
std::sprintf(&msgtemp[i], " %s [1234] ", nick);
i += std::strlen(&msgtemp[i]);
}
if (account_get_command_groups(conn_get_account(tc)) == 4)
if ((nick = conn_get_username(tc)))
{
if (i + std::strlen(nick) + 2>sizeof(msgtemp)) /* " ", name, '\0' */
{
message_send_text(c, message_type_info, c, msgtemp);
i = 0;
}
std::sprintf(&msgtemp[i], " %s [123] ", nick);
i += std::strlen(&msgtemp[i]);
}
if (account_get_command_groups(conn_get_account(tc)) == 2)
if ((nick = conn_get_username(tc)))
{
if (i + std::strlen(nick) + 2>sizeof(msgtemp)) /* " ", name, '\0' */
{
message_send_text(c, message_type_info, c, msgtemp);
i = 0;
}
std::sprintf(&msgtemp[i], " %s [12] ", nick);
i += std::strlen(&msgtemp[i]);
}
else
{
std::sprintf(&msgtemp[i], " %s [1] ", nick);
i += std::strlen(&msgtemp[i]);
}
}
if (i>0)
message_send_text(c, message_type_info, c, msgtemp);
return 0;
}