remove \r from irc in on windows

This commit is contained in:
Aaron Blakely 2024-02-16 17:32:54 -06:00
parent c0de3e4bbc
commit 6db8e620b1
3 changed files with 31 additions and 0 deletions

View File

@ -61,6 +61,7 @@ MY_API BOOL is_halfop(char *chan, char *nick);
MY_API BOOL is_voice(char *chan, char *nick); MY_API BOOL is_voice(char *chan, char *nick);
MY_API BOOL channel_exists(char *chan); MY_API BOOL channel_exists(char *chan);
MY_API BOOL user_exists(char *chan, char *nick); MY_API BOOL user_exists(char *chan, char *nick);
MY_API BOOL is_on_channel(char *nick, char *chan);
#else #else
MY_API bool is_op(char *chan, char *nick); MY_API bool is_op(char *chan, char *nick);
MY_API bool is_halfop(char *chan, char *nick); MY_API bool is_halfop(char *chan, char *nick);
@ -69,6 +70,7 @@ MY_API bool is_owner(char *chan, char *nick);
MY_API bool is_admin(char *chan, char *nick); MY_API bool is_admin(char *chan, char *nick);
MY_API bool channel_exists(char *chan); MY_API bool channel_exists(char *chan);
MY_API bool user_exists(char *chan, char *nick); MY_API bool user_exists(char *chan, char *nick);
MY_API bool is_on_channel(char *nick, char *chan);
#endif #endif
#endif #endif

View File

@ -401,3 +401,30 @@ MY_API bool user_exists(char *chan, char *nick)
return 0; return 0;
} }
#ifdef _WIN32
MY_API BOOL is_on_channel(char *nick, char *chan)
#else
MY_API bool is_on_channel(char *nick, char *chan)
#endif
{
int i;
for (i = 0; i < chan_count; i++)
{
if (!strcmp(channels[i]->name, chan))
{
int j;
for (j = 0; j < channels[i]->user_count; j++)
{
if (!strcmp(channels[i]->users[j].nick, nick))
{
return 1;
}
}
}
}
return 0;
}

View File

@ -121,6 +121,8 @@ int main()
while (1) while (1)
{ {
// remove \r
p = strchr(bot.in, '\r');
p = strchr(bot.in, '\n'); p = strchr(bot.in, '\n');
if (p == NULL) if (p == NULL)
break; break;