Topic: [solved] please helpe me new command for /getclan
Please help me to solved this code , i alr compile success but when , i type /getclan my server disconnect huhuhu
static int _handle_getclan_command(t_connection * c, char const *text)
{
char dest[MAX_USERNAME_LEN];
unsigned int i,j;
t_account * account;
t_connection * conn;
char const * ip;
char * tok;
t_clanmember * clanmemb;
std::time_t then;
struct std::tm * tmthen;
for (i=0; text[i]!=' ' && text[i]!='\0'; i++); /* skip command */
for (; text[i]==' '; i++);
for (j=0; text[i]!=' ' && text[i]!='\0'; i++) /* get dest */
if (j<sizeof(dest)-1) dest[j++] = text[i];
dest[j] = '\0';
for (; text[i]==' '; i++);
if (dest[0]=='\0')
{
message_send_text(c,message_type_info,c,"usage: /getclan <account>");
return 0;
}
if (!(account = accountlist_find_account(dest)))
{
message_send_text(c,message_type_error,c,"Invalid user.");
return 0;
}
then = account_get_ll_ctime(account);
tmthen = std::localtime(&then); /* FIXME: determine user's timezone */
if ((clan = clanmember_get_clan(clanmemb)))
{
snprintf(msgtemp, sizeof(msgtemp), "Clan : %.4s", clan_get_clantag(clan));
message_send_text(c, message_type_whisper, c, msgtemp);
std::strncpy(msgtemp,account_get_desc(account),sizeof(msgtemp));
msgtemp[sizeof(msgtemp)-1] = '\0';
for (tok=std::strtok(msgtemp,"\r\n"); tok; tok=std::strtok(NULL,"\r\n"))
message_send_text(c,message_type_info,c,tok);
message_send_text(c,message_type_info,c,"");
return 0;
}