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

it's impossible to get newly opened buffer's type (private/channel) if relay is not doing a full sync #191

Closed
oakkitten opened this Issue Sep 7, 2014 · 0 comments

Comments

Projects
None yet
2 participants
@oakkitten
Copy link

oakkitten commented Sep 7, 2014

if i do

    sync * buffers

then for opened buffers i get this

    _buffer_opened
    _buffer_merged
    _buffer_renamed

while doing a full sync i also get

    _buffer_localvar_added
    _buffer_localvar_added
    _buffer_localvar_added
    _buffer_localvar_added

these local variables, as far as i know, is the only way to tell if the buffer is private or channel. this is in fact what i'm doing (can i have other channel types that would indicate single-user and multiuser conversations?):

    /** determine if the buffer is PRIVATE, CHANNEL, or OTHER */
    private void processBufferType() {
        final RelayObject t = local_vars.get("type");
        if (t == null) type = OTHER;
        else if ("private".equals(t.asString())) type = PRIVATE;
        else if ("channel".equals(t.asString())) type = CHANNEL;
        else type = OTHER;
    }

this is necessary to determine if i should alert the user if i receive a message that is not highlight. in case of PRIVATE, i alert user on every message. by the way, this is how i determine if the message is, well, a message (is this a proper way?):

    private int findOutMessageType() {
        // there's no tags, probably it's an old version of weechat, so we err
        // on the safe side and treat it as from human
        if (tags == null) return LINE_MESSAGE;

        if (tags.length == 0) return LINE_OTHER;

        final List list = Arrays.asList(tags);
        if (!list.contains("log1")) return LINE_OTHER;
        return list.contains("notify_none") ? LINE_OWN : LINE_MESSAGE;
    }

anyways, the problem is that in _buffer_opened event i get no local vars. and i do not receive any updates. so the buffer type remains OTHER and i can't know if i should be alerting user or not. i suggest either squashing the events together into one _buffer_opened_together_with_tags_and_all event, or enabling _buffer_localvar_added for sync * buffers. or something...

@flashcode flashcode added the bug label Sep 19, 2014

@flashcode flashcode added this to the 1.1 milestone Oct 30, 2014

@flashcode flashcode self-assigned this Oct 30, 2014

@flashcode flashcode closed this in debfb57 Nov 16, 2014

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.