Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
irker
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iDB
irker
Commits
42aafbc1
Commit
42aafbc1
authored
12 years ago
by
Eric S. Raymond
Browse files
Options
Downloads
Patches
Plain Diff
Improved debugging.
parent
228f4bda
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
irclib.py
+13
-27
13 additions, 27 deletions
irclib.py
with
13 additions
and
27 deletions
irclib.py
+
13
−
27
View file @
42aafbc1
...
...
@@ -81,8 +81,6 @@ try:
except
Exception
:
VERSION
=
()
DEBUG
=
False
# TODO
# ----
# (maybe) thread safety
...
...
@@ -581,8 +579,7 @@ class ServerConnection(Connection):
self
.
previous_buffer
=
lines
.
pop
()
for
line
in
lines
:
if
DEBUG
:
print
"
FROM SERVER:
"
,
line
self
.
irclibobj
.
debug
(
1
,
"
FROM SERVER: %s
"
%
repr
(
line
))
if
not
line
:
continue
...
...
@@ -643,16 +640,12 @@ class ServerConnection(Connection):
command
=
"
ctcpreply
"
m
=
list
(
m
)
if
DEBUG
:
print
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
m
)
self
.
irclibobj
.
debug
(
1
,
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
m
))
self
.
_handle_event
(
Event
(
command
,
prefix
,
target
,
m
))
if
command
==
"
ctcp
"
and
m
[
0
]
==
"
ACTION
"
:
self
.
_handle_event
(
Event
(
"
action
"
,
prefix
,
target
,
m
[
1
:]))
else
:
if
DEBUG
:
print
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
[
m
])
self
.
irclibobj
.
debug
(
1
,
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
[
m
]))
self
.
_handle_event
(
Event
(
command
,
prefix
,
target
,
[
m
]))
else
:
target
=
None
...
...
@@ -669,9 +662,7 @@ class ServerConnection(Connection):
if
not
is_channel
(
target
):
command
=
"
umode
"
if
DEBUG
:
print
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
arguments
)
self
.
irclibobj
.
debug
(
1
,
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
m
))
self
.
_handle_event
(
Event
(
command
,
prefix
,
target
,
arguments
))
def
_handle_event
(
self
,
event
):
...
...
@@ -866,8 +857,7 @@ class ServerConnection(Connection):
self
.
ssl
.
write
(
string
+
"
\r\n
"
)
else
:
self
.
socket
.
send
(
string
+
"
\r\n
"
)
if
DEBUG
:
print
"
TO SERVER:
"
,
string
self
.
irclibobj
.
debug
(
1
,
"
TO SERVER:
"
+
repr
(
string
))
except
socket
.
error
:
# Ouch!
self
.
disconnect
(
"
Connection reset by peer.
"
)
...
...
@@ -941,6 +931,7 @@ class DCCConnection(Connection):
"""
def
__init__
(
self
,
irclibobj
,
dcctype
):
super
(
DCCConnection
,
self
).
__init__
(
irclibobj
)
self
.
irclibobj
=
irclibobj
self
.
connected
=
0
self
.
passive
=
0
self
.
dcctype
=
dcctype
...
...
@@ -1024,9 +1015,8 @@ class DCCConnection(Connection):
self
.
socket
.
close
()
self
.
socket
=
conn
self
.
connected
=
1
if
DEBUG
:
print
"
DCC connection from %s:%d
"
%
(
self
.
peeraddress
,
self
.
peerport
)
self
.
irclibobj
.
debug
(
1
,
"
DCC connection from %s:%d
"
%
(
self
.
peeraddress
,
self
.
peerport
))
self
.
irclibobj
.
_handle_event
(
self
,
Event
(
"
dcc_connect
"
,
self
.
peeraddress
,
None
,
None
))
...
...
@@ -1062,12 +1052,10 @@ class DCCConnection(Connection):
prefix
=
self
.
peeraddress
target
=
None
for
chunk
in
chunks
:
if
DEBUG
:
print
"
FROM PEER:
"
,
chunk
self
.
irclibobj
.
debug
(
1
,
"
FROM PEER:
"
+
repr
(
chunk
))
arguments
=
[
chunk
]
if
DEBUG
:
print
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
arguments
)
self
.
irclibobj
.
debug
(
1
,
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
arguments
))
self
.
irclibobj
.
_handle_event
(
self
,
Event
(
command
,
prefix
,
target
,
arguments
))
...
...
@@ -1086,8 +1074,7 @@ class DCCConnection(Connection):
self
.
socket
.
send
(
string
)
if
self
.
dcctype
==
"
chat
"
:
self
.
socket
.
send
(
"
\n
"
)
if
DEBUG
:
print
"
TO PEER: %s
\n
"
%
string
self
.
irclibobj
.
debug
(
"
TO PEER: %s
\n
"
%
repr
(
string
))
except
socket
.
error
:
# Ouch!
self
.
disconnect
(
"
Connection reset by peer.
"
)
...
...
@@ -1122,8 +1109,7 @@ class SimpleIRCClient(object):
def
_dispatcher
(
self
,
c
,
e
):
"""
[Internal]
"""
if
DEBUG
:
print
(
"
irclib.py:_dispatcher:%s
"
%
e
.
eventtype
())
self
.
irclibobj
.
debug
(
"
dispatcher:%s
"
%
e
.
eventtype
())
m
=
"
on_
"
+
e
.
eventtype
()
if
hasattr
(
self
,
m
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment