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:
...
@@ -81,8 +81,6 @@ try:
except
Exception
:
except
Exception
:
VERSION
=
()
VERSION
=
()
DEBUG
=
False
# TODO
# TODO
# ----
# ----
# (maybe) thread safety
# (maybe) thread safety
...
@@ -581,8 +579,7 @@ class ServerConnection(Connection):
...
@@ -581,8 +579,7 @@ class ServerConnection(Connection):
self
.
previous_buffer
=
lines
.
pop
()
self
.
previous_buffer
=
lines
.
pop
()
for
line
in
lines
:
for
line
in
lines
:
if
DEBUG
:
self
.
irclibobj
.
debug
(
1
,
"
FROM SERVER: %s
"
%
repr
(
line
))
print
"
FROM SERVER:
"
,
line
if
not
line
:
if
not
line
:
continue
continue
...
@@ -643,16 +640,12 @@ class ServerConnection(Connection):
...
@@ -643,16 +640,12 @@ class ServerConnection(Connection):
command
=
"
ctcpreply
"
command
=
"
ctcpreply
"
m
=
list
(
m
)
m
=
list
(
m
)
if
DEBUG
:
self
.
irclibobj
.
debug
(
1
,
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
m
))
print
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
m
)
self
.
_handle_event
(
Event
(
command
,
prefix
,
target
,
m
))
self
.
_handle_event
(
Event
(
command
,
prefix
,
target
,
m
))
if
command
==
"
ctcp
"
and
m
[
0
]
==
"
ACTION
"
:
if
command
==
"
ctcp
"
and
m
[
0
]
==
"
ACTION
"
:
self
.
_handle_event
(
Event
(
"
action
"
,
prefix
,
target
,
m
[
1
:]))
self
.
_handle_event
(
Event
(
"
action
"
,
prefix
,
target
,
m
[
1
:]))
else
:
else
:
if
DEBUG
:
self
.
irclibobj
.
debug
(
1
,
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
[
m
]))
print
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
[
m
])
self
.
_handle_event
(
Event
(
command
,
prefix
,
target
,
[
m
]))
self
.
_handle_event
(
Event
(
command
,
prefix
,
target
,
[
m
]))
else
:
else
:
target
=
None
target
=
None
...
@@ -669,9 +662,7 @@ class ServerConnection(Connection):
...
@@ -669,9 +662,7 @@ class ServerConnection(Connection):
if
not
is_channel
(
target
):
if
not
is_channel
(
target
):
command
=
"
umode
"
command
=
"
umode
"
if
DEBUG
:
self
.
irclibobj
.
debug
(
1
,
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
m
))
print
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
arguments
)
self
.
_handle_event
(
Event
(
command
,
prefix
,
target
,
arguments
))
self
.
_handle_event
(
Event
(
command
,
prefix
,
target
,
arguments
))
def
_handle_event
(
self
,
event
):
def
_handle_event
(
self
,
event
):
...
@@ -866,8 +857,7 @@ class ServerConnection(Connection):
...
@@ -866,8 +857,7 @@ class ServerConnection(Connection):
self
.
ssl
.
write
(
string
+
"
\r\n
"
)
self
.
ssl
.
write
(
string
+
"
\r\n
"
)
else
:
else
:
self
.
socket
.
send
(
string
+
"
\r\n
"
)
self
.
socket
.
send
(
string
+
"
\r\n
"
)
if
DEBUG
:
self
.
irclibobj
.
debug
(
1
,
"
TO SERVER:
"
+
repr
(
string
))
print
"
TO SERVER:
"
,
string
except
socket
.
error
:
except
socket
.
error
:
# Ouch!
# Ouch!
self
.
disconnect
(
"
Connection reset by peer.
"
)
self
.
disconnect
(
"
Connection reset by peer.
"
)
...
@@ -941,6 +931,7 @@ class DCCConnection(Connection):
...
@@ -941,6 +931,7 @@ class DCCConnection(Connection):
"""
"""
def
__init__
(
self
,
irclibobj
,
dcctype
):
def
__init__
(
self
,
irclibobj
,
dcctype
):
super
(
DCCConnection
,
self
).
__init__
(
irclibobj
)
super
(
DCCConnection
,
self
).
__init__
(
irclibobj
)
self
.
irclibobj
=
irclibobj
self
.
connected
=
0
self
.
connected
=
0
self
.
passive
=
0
self
.
passive
=
0
self
.
dcctype
=
dcctype
self
.
dcctype
=
dcctype
...
@@ -1024,9 +1015,8 @@ class DCCConnection(Connection):
...
@@ -1024,9 +1015,8 @@ class DCCConnection(Connection):
self
.
socket
.
close
()
self
.
socket
.
close
()
self
.
socket
=
conn
self
.
socket
=
conn
self
.
connected
=
1
self
.
connected
=
1
if
DEBUG
:
self
.
irclibobj
.
debug
(
1
,
"
DCC connection from %s:%d
"
%
(
print
"
DCC connection from %s:%d
"
%
(
self
.
peeraddress
,
self
.
peerport
))
self
.
peeraddress
,
self
.
peerport
)
self
.
irclibobj
.
_handle_event
(
self
.
irclibobj
.
_handle_event
(
self
,
self
,
Event
(
"
dcc_connect
"
,
self
.
peeraddress
,
None
,
None
))
Event
(
"
dcc_connect
"
,
self
.
peeraddress
,
None
,
None
))
...
@@ -1062,12 +1052,10 @@ class DCCConnection(Connection):
...
@@ -1062,12 +1052,10 @@ class DCCConnection(Connection):
prefix
=
self
.
peeraddress
prefix
=
self
.
peeraddress
target
=
None
target
=
None
for
chunk
in
chunks
:
for
chunk
in
chunks
:
if
DEBUG
:
self
.
irclibobj
.
debug
(
1
,
"
FROM PEER:
"
+
repr
(
chunk
))
print
"
FROM PEER:
"
,
chunk
arguments
=
[
chunk
]
arguments
=
[
chunk
]
if
DEBUG
:
self
.
irclibobj
.
debug
(
1
,
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
print
"
command: %s, source: %s, target: %s, arguments: %s
"
%
(
command
,
prefix
,
target
,
arguments
))
command
,
prefix
,
target
,
arguments
)
self
.
irclibobj
.
_handle_event
(
self
.
irclibobj
.
_handle_event
(
self
,
self
,
Event
(
command
,
prefix
,
target
,
arguments
))
Event
(
command
,
prefix
,
target
,
arguments
))
...
@@ -1086,8 +1074,7 @@ class DCCConnection(Connection):
...
@@ -1086,8 +1074,7 @@ class DCCConnection(Connection):
self
.
socket
.
send
(
string
)
self
.
socket
.
send
(
string
)
if
self
.
dcctype
==
"
chat
"
:
if
self
.
dcctype
==
"
chat
"
:
self
.
socket
.
send
(
"
\n
"
)
self
.
socket
.
send
(
"
\n
"
)
if
DEBUG
:
self
.
irclibobj
.
debug
(
"
TO PEER: %s
\n
"
%
repr
(
string
))
print
"
TO PEER: %s
\n
"
%
string
except
socket
.
error
:
except
socket
.
error
:
# Ouch!
# Ouch!
self
.
disconnect
(
"
Connection reset by peer.
"
)
self
.
disconnect
(
"
Connection reset by peer.
"
)
...
@@ -1122,8 +1109,7 @@ class SimpleIRCClient(object):
...
@@ -1122,8 +1109,7 @@ class SimpleIRCClient(object):
def
_dispatcher
(
self
,
c
,
e
):
def
_dispatcher
(
self
,
c
,
e
):
"""
[Internal]
"""
"""
[Internal]
"""
if
DEBUG
:
self
.
irclibobj
.
debug
(
"
dispatcher:%s
"
%
e
.
eventtype
())
print
(
"
irclib.py:_dispatcher:%s
"
%
e
.
eventtype
())
m
=
"
on_
"
+
e
.
eventtype
()
m
=
"
on_
"
+
e
.
eventtype
()
if
hasattr
(
self
,
m
):
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