… | |
… | |
70 | return if $CON; |
70 | return if $CON; |
71 | |
71 | |
72 | $CON = AnyEvent::IRC::Client->new; |
72 | $CON = AnyEvent::IRC::Client->new; |
73 | $CON->set_exception_cb (sub { |
73 | $CON->set_exception_cb (sub { |
74 | my ($exp, $ev) = @_; |
74 | my ($exp, $ev) = @_; |
75 | warn "IRC: IRC EXCEPTION (event $ev): $exp\n"; |
75 | cf::error "IRC: IRC EXCEPTION (event $ev): $exp\n"; |
76 | }); |
76 | }); |
77 | $CON->connect ($BOTSERVER, $BOTPORT, { |
77 | $CON->connect ($BOTSERVER, $BOTPORT, { |
78 | nick => $BOTNAME, |
78 | nick => $BOTNAME, |
79 | user => $BOTNAME, |
79 | user => $BOTNAME, |
80 | real => 'deliantra server' |
80 | real => 'deliantra server' |
… | |
… | |
104 | }, |
104 | }, |
105 | connect => sub { |
105 | connect => sub { |
106 | my ($con, $error) = @_; |
106 | my ($con, $error) = @_; |
107 | |
107 | |
108 | if ($error) { |
108 | if ($error) { |
109 | warn "IRC: CONNECT ERROR to IRC server: $BOTSERVER:$BOTPORT: $error\n"; |
109 | cf::error "IRC: CONNECT ERROR to IRC server: $BOTSERVER:$BOTPORT: $error\n"; |
110 | undef $CON; |
110 | undef $CON; |
111 | |
111 | |
112 | } else { |
112 | } else { |
113 | warn "IRC: connected to IRC server: $BOTSERVER:$BOTPORT\n"; |
113 | cf::info "IRC: connected to IRC server: $BOTSERVER:$BOTPORT\n"; |
114 | } |
114 | } |
115 | }, |
115 | }, |
116 | registered => sub { |
116 | registered => sub { |
117 | warn "IRC: successfully logged into IRC server: $BOTSERVER:$BOTPORT\n"; |
117 | cf::info "IRC: successfully logged into IRC server: $BOTSERVER:$BOTPORT\n"; |
118 | }, |
118 | }, |
119 | error => sub { |
119 | error => sub { |
120 | my ($con, $code, $message) = @_; |
120 | my ($con, $code, $message) = @_; |
121 | warn "IRC: IRC ERROR ($code) $message\n"; |
121 | cf::error "IRC: IRC ERROR ($code) $message\n"; |
122 | }, |
122 | }, |
123 | disconnect => sub { |
123 | disconnect => sub { |
124 | my ($con, $reason) = @_; |
124 | my ($con, $reason) = @_; |
125 | warn "IRC: disconnect: $reason\n"; |
125 | cf::warn "IRC: disconnect: $reason\n"; |
126 | undef $CON; |
126 | undef $CON; |
127 | } |
127 | } |
128 | ); |
128 | ); |
129 | } |
129 | } |
130 | |
130 | |