Perl CChan::HasPerm TypeError #810

Closed
opened 2026-10-05 04:45:53 +02:00 by adam · 0 comments
Owner

I need to know if I have Op permission on the current chan in a perl OnJoin
sub handler. I try to use the CChan::HasPerm method without success.

$chan->HasPerm($ZNC::CChan::Op) and $chan->HasPerm('@') all fails with the error TypeError in method 'CChan_HasPerm', argument 2 of type 'unsigned char' at ...

Am I doing it wrong (then, how to do it right) or is this a bug in znc ?

Example to reproduce the error :

sub OnJoin($$)
{
    my $self = shift;
    my ($nick, $chan) = @_;

    eval
    {
        $chan->HasPerm($ZNC::CChan::Op);
    };
    if ($@)
    {
        $self->PutModule("test with \$ZNC::CChan::Op => $@");
    };

    eval
    {
        $chan->HasPerm('@');
    };
    if ($@)
    {
        $self->PutModule("test with '\@' => $@");
    };

    return $ZNC::CONTINUE;
}

This example produce the following outpout:

[2018-01-19 12:01] <*AutoOp2> test with $ZNC::CChan::Op => TypeError in method 'CChan_HasPerm', argument 2 of type 'unsigned char' at /usr/local/etc/znc/modules/AutoOp2.pm line 73.
[2018-01-19 12:01] <*AutoOp2> test with '@' => TypeError in method 'CChan_HasPerm', argument 2 of type 'unsigned char' at /usr/local/etc/znc/modules/AutoOp2.pm line 82.

My configuration:

% znc --version
ZNC 1.6.5 - http://znc.in
IPv6: yes, SSL: yes, DNS: threads, charset: no

% uname -rv
11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC

% pkg info znc
znc-1.6.5_4
Name           : znc
Version        : 1.6.5_4
Installed on   : Sat Jan 13 12:34:31 2018 CET
Origin         : irc/znc
Architecture   : FreeBSD:11:amd64
Prefix         : /usr/local
Categories     : irc ipv6
Licenses       : APACHE20
Maintainer     : dbaio@FreeBSD.org
WWW            : http://znc.in/
Comment        : Advanced IRC bouncer
Options        :
    CHARSET        : off
    CYRUS          : off
    DEBUG          : off
    DOCS           : on
    IPV6           : on
    OPENSSL        : on
    PERL           : on
    PYTHON         : off
    TCL            : off
Shared Libs required:
    libperl.so.5.24
Annotations    :
    cpe            : cpe:2.3:a:znc:znc:1.6.5:::::freebsd11:x64:4
    repo_type      : binary
    repository     : FreeBSD

I need to know if I have Op permission on the current chan in a perl OnJoin sub handler. I try to use the CChan::HasPerm method without success. $chan->HasPerm($ZNC::CChan::Op) and $chan->HasPerm('@') all fails with the error TypeError in method 'CChan_HasPerm', argument 2 of type 'unsigned char' at ... Am I doing it wrong (then, how to do it right) or is this a bug in znc ? Example to reproduce the error : ```perl sub OnJoin($$) { my $self = shift; my ($nick, $chan) = @_; eval { $chan->HasPerm($ZNC::CChan::Op); }; if ($@) { $self->PutModule("test with \$ZNC::CChan::Op => $@"); }; eval { $chan->HasPerm('@'); }; if ($@) { $self->PutModule("test with '\@' => $@"); }; return $ZNC::CONTINUE; } ``` This example produce the following outpout: [2018-01-19 12:01] <*AutoOp2> test with $ZNC::CChan::Op => TypeError in method 'CChan_HasPerm', argument 2 of type 'unsigned char' at /usr/local/etc/znc/modules/AutoOp2.pm line 73. [2018-01-19 12:01] <*AutoOp2> test with '@' => TypeError in method 'CChan_HasPerm', argument 2 of type 'unsigned char' at /usr/local/etc/znc/modules/AutoOp2.pm line 82. My configuration: ``` % znc --version ZNC 1.6.5 - http://znc.in IPv6: yes, SSL: yes, DNS: threads, charset: no % uname -rv 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC % pkg info znc znc-1.6.5_4 Name : znc Version : 1.6.5_4 Installed on : Sat Jan 13 12:34:31 2018 CET Origin : irc/znc Architecture : FreeBSD:11:amd64 Prefix : /usr/local Categories : irc ipv6 Licenses : APACHE20 Maintainer : dbaio@FreeBSD.org WWW : http://znc.in/ Comment : Advanced IRC bouncer Options : CHARSET : off CYRUS : off DEBUG : off DOCS : on IPV6 : on OPENSSL : on PERL : on PYTHON : off TCL : off Shared Libs required: libperl.so.5.24 Annotations : cpe : cpe:2.3:a:znc:znc:1.6.5:::::freebsd11:x64:4 repo_type : binary repository : FreeBSD ``` <!-- github-sync-id:289941837 -->
adam closed this issue 2026-10-05 04:45:53 +02:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#810