Topic: [Guide] new command to see operators who are connected online
I leave this command, new to some, I hope it helps someone and greetings
Add in command.cpp
static int _handle_ops_command(t_connection * c, char const * text);
add after
{ "/ops" , _handle_ops_command },
add after
/* VER OPERADORES */
static int _handle_ops_command(t_connection * c, char const *text)
{
unsigned int i;
t_elem const * curr;
t_connection * tc;
char const * nick;
std::strcpy(msgtemp,"Operadores actualmente conectados:");
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_auth_operator(conn_get_account(tc),NULL)==1)
{
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", nick);
i += std::strlen(&msgtemp[i]);
}
}
}
if (i>0)
message_send_text(c,message_type_info,c,msgtemp);
return 0;
}