Topic: [GUIDE]New Command /online (see crew online on battlenet
static int _handle_online_command(t_connection * c, char const *text)
{
unsigned int i;
t_elem const * curr;
t_connection * tc;
char const * nick;
/*Edited by Somad Sikimat (Zeloit) 3/5/2012*/
message_send_text(c,message_type_error,c,"=-=-= Online Guardian Crew =-=-=");
std::strcpy(msgtemp,"Owner Online:");
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_owner(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);
std::strcpy(msgtemp,"Master Online:");
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_master(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);
std::strcpy(msgtemp,"Developer Online:");
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_developer(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);
std::strcpy(msgtemp,"Head Admin Online:");
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_headadmin(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);
std::strcpy(msgtemp,"Admin Online:");
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_admin(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);
std::strcpy(msgtemp,"Supervisor Online:");
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_supervisor(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);
std::strcpy(msgtemp,"Head Operator Online:");
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_headoperator(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);
std::strcpy(msgtemp,"Operator Online:");
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);
std::strcpy(msgtemp,"Voice Operator Online:");
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_voiceoperator(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);
std::strcpy(msgtemp,"Analyzer Online:");
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_cat(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);
std::strcpy(msgtemp,"Team Event Online:");
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_te(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;
}
/online other type:
static int _handle_onlinecrew_command(t_connection * c, char const *text)
{
unsigned int i;
t_elem const * curr;
t_connection * tc;
char const * nick;
/* Edited by Somad Sikimat (Zeloit) 2/2/2012 */
std::strcpy(msgtemp,"Currently Online Crew:");
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_owner(conn_get_account(tc),NULL)==1) ||
(account_get_auth_master(conn_get_account(tc),NULL)==1) ||
(account_get_auth_developer(conn_get_account(tc),NULL)==1) ||
(account_get_auth_headadmin(conn_get_account(tc),NULL)==1) ||
(account_get_auth_admin(conn_get_account(tc),NULL)==1) ||
(account_get_auth_cs(conn_get_account(tc),NULL)==1) ||
(account_get_auth_supervisor(conn_get_account(tc),NULL)==1) ||
(account_get_auth_headoperator(conn_get_account(tc),NULL)==1) ||
(account_get_auth_operator(conn_get_account(tc),NULL)==1) ||
(account_get_auth_voiceoperator(conn_get_account(tc),NULL)==1) ||
(account_get_auth_cat(conn_get_account(tc),NULL)==1) ||
(account_get_auth_te(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;
}