Skip to content

Instantly share code, notes, and snippets.

@HarpyWar
Created October 18, 2012 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HarpyWar/3912580 to your computer and use it in GitHub Desktop.
Save HarpyWar/3912580 to your computer and use it in GitHub Desktop.
Clan tag is case-sensitive in 1.8.5 and case-insensitive in 1.99
extern t_clan *clanlist_find_clan_by_clantag(int clantag)
{
t_elem *curr;
t_clan *clan;
if (clantag == 0)
return NULL;
if (clanlist_head)
{
LIST_TRAVERSE(clanlist_head, curr)
{
if (!(clan = elem_get_data(curr)))
{
eventlog(eventlog_level_error, __FUNCTION__, "found NULL entry in list");
continue;
}
if (clan->created && (clan->clantag == clantag))
return clan;
}
}
return NULL;
}
extern t_clan *clanlist_find_clan_by_clantag(t_clantag clantag)
{
t_elem *curr;
t_clan *clan;
char * needle;
if (clantag == 0)
return NULL;
needle = xstrdup(clantag_to_str(clantag));
if (clanlist_head)
{
LIST_TRAVERSE(clanlist_head, curr)
{
if (!(clan = (t_clan*)elem_get_data(curr)))
{
eventlog(eventlog_level_error, __FUNCTION__, "found NULL entry in list");
continue;
}
if (clan->created && !strcasecmp(needle, clantag_to_str(clan->tag))) {
xfree(needle);
return clan;
}
}
}
xfree(needle);
return NULL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment