Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

irc: add support for CAP account-notify #246

Merged
merged 2 commits into from Jan 25, 2015

Conversation

Projects
None yet
3 participants
@maxteufel
Copy link
Contributor

commented Nov 2, 2014

What the title says, might break some scripts because I've changed some variables.

Edit: again, I didn't add it to the help yet.

@@ -662,6 +666,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
/* initialize new nick */
new_nick->name = strdup (nickname);
new_nick->host = (host) ? strdup (host) : NULL;
new_nick->account = (account) ? strdup (account) : NULL;

This comment has been minimized.

Copy link
@flashcode

flashcode Nov 2, 2014

Member

Except if I'm wrong, the account var in nick is not freed in irc_nick_free()

{
ptr_nick = irc_nick_search (server, ptr_channel, nick);
if (ptr_nick)
ptr_nick->account = strdup (argv[2]);

This comment has been minimized.

Copy link
@flashcode

flashcode Nov 2, 2014

Member

I think you should first free value of account in nick (if not NULL) before doing the strdup with new value.

pos_realname = (argc > 11) ?
((argv_eol[11][0] == ':') ? argv_eol[11] + 1 : argv_eol[11]) : NULL;

if (strcmp(argv[10], "0") == 0)

This comment has been minimized.

Copy link
@flashcode

flashcode Nov 2, 2014

Member

Here, I would just set a pointer to argv[10] (if needed) and keep NULL otherwise. Then later, I would strdup this value (if not NULL), or strdup("*") otherwise.

@maxteufel maxteufel force-pushed the maxteufel:feature/account-notify branch from 7fb251e to e5b7011 Nov 2, 2014

@maxteufel

This comment has been minimized.

Copy link
Contributor Author

commented Nov 2, 2014

@flashcode should be fixed now.

@flashcode flashcode added this to the 1.1 milestone Nov 16, 2014

@flashcode flashcode self-assigned this Nov 16, 2014

@maxteufel maxteufel force-pushed the maxteufel:feature/account-notify branch from e5b7011 to ff2f840 Dec 7, 2014

@flashcode flashcode modified the milestones: 1.1, 1.2 Dec 21, 2014

}
else
irc_channel_remove_away (server, channel);

This comment has been minimized.

Copy link
@flashcode

flashcode Jan 18, 2015

Member

Why did you remove the call to irc_channel_remove_away() ?
I think if you remove this line, the nicks will never be reset to normal color (in nicklist) if you turn off away checking option.

ptr_nick = irc_nick_search (server, ptr_channel, nick);
if (ptr_nick)
{
free (ptr_nick->account);

This comment has been minimized.

Copy link
@flashcode

flashcode Jan 18, 2015

Member

I would check the value of ptr_nick->account here, just to be sure it's not NULL, ie:

if (ptr_nick->account)
    free (ptr_nick->account)
/* update away flag for nick */
if (ptr_channel && ptr_nick && pos_attr
&& (server->cap_away_notify
|| ((IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK) > 0)

This comment has been minimized.

Copy link
@flashcode

flashcode Jan 18, 2015

Member

Small indentation problem in this condition (for readability).

@maxteufel maxteufel force-pushed the maxteufel:feature/account-notify branch 2 times, most recently from e76e5e7 to 84bcd55 Jan 18, 2015

@maxteufel maxteufel force-pushed the maxteufel:feature/account-notify branch from 84bcd55 to d39a033 Jan 24, 2015

@maxteufel maxteufel force-pushed the maxteufel:feature/account-notify branch from d39a033 to eea6b07 Jan 24, 2015

@flashcode flashcode merged commit eea6b07 into weechat:master Jan 25, 2015

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

flashcode added a commit that referenced this pull request Jan 25, 2015

@maxteufel maxteufel deleted the maxteufel:feature/account-notify branch Jan 25, 2015

@stfnm

This comment has been minimized.

Copy link
Contributor

commented on src/plugins/irc/irc-channel.c in f379adf Aug 28, 2015

It seems to me that since this change was introduced (and whenever the account-notify capability is enabled of course) the irc server option away_check_max_nicks no longer prevents WeeChat from doing WHOs even on channels that have much larger nick counts than specified as max. I noticed this with /server raw. Is this intended behaviour?

This comment has been minimized.

Copy link
Contributor Author

replied Aug 28, 2015

When joining a channel and account-notify is enabled, this is intended (to ensure we have account data for every nick). On the other side, this probably shouldn't happen after the first WHO (we can track account changes using account-notify and get the account of new users using extended-join, so this information is redundant).

This comment has been minimized.

Copy link
Contributor

replied Aug 28, 2015

@maxteufel Yeah that's what I meant; the WHOs continue in the interval specified in the irc server option away_check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.