Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
guppy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Svetlana Tkachenko
guppy
Commits
fea5c7e2
Commit
fea5c7e2
authored
13 years ago
by
Svetlana Tkachenko
Browse files
Options
Downloads
Patches
Plain Diff
Workaround
http://bugs.python.org/issue12523
; add srpass for better auth
parent
58f5ad7a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
guppy
+1
-0
1 addition, 0 deletions
guppy
irc.py
+11
-9
11 additions, 9 deletions
irc.py
with
14 additions
and
9 deletions
.gitignore
+
2
−
0
View file @
fea5c7e2
__pycache__
*/__pycache__
*.pyc
conf
*.cfg
...
...
This diff is collapsed.
Click to expand it.
guppy
+
1
−
0
View file @
fea5c7e2
...
...
@@ -123,6 +123,7 @@ optional arguments:
self
.
set
(
currentNetwork
,
'
owner_nick
'
,
"
Your username (use the auth plugin to set a password)
"
)
self
.
set
(
currentNetwork
,
'
ns_name
'
,
"
NickServ username (if there is none, press ENTER)
"
)
self
.
set
(
currentNetwork
,
'
ns_pwd
'
,
"
NickServ password (if there is none, press ENTER)
"
)
self
.
set
(
currentNetwork
,
'
srpass
'
,
"
Server password (used on private servers or for Services auth)
"
)
self
.
set
(
currentNetwork
,
'
port
'
,
"
Port
"
,
"
6667
"
)
self
.
set
(
currentNetwork
,
'
use_ssl
'
,
'
Use ssl (yes/no)
'
,
'
no
'
)
self
.
set
(
currentNetwork
,
"
comchar
"
,
"
My command char
"
,
"
-
"
)
...
...
This diff is collapsed.
Click to expand it.
irc.py
+
11
−
9
View file @
fea5c7e2
...
...
@@ -145,6 +145,9 @@ class PluginManager(object):
self
.
unloadPlugin
(
plugin
.
lower
())
class
IRC
(
asynchat
.
async_chat
):
def
handle_error
(
self
):
'''
Print a traceback when an error happens
'''
traceback
.
print_exc
()
def
__init__
(
self
,
config
):
asynchat
.
async_chat
.
__init__
(
self
)
self
.
pluginManager
=
PluginManager
(
self
)
...
...
@@ -157,8 +160,8 @@ class IRC(asynchat.async_chat):
errs
=
self
.
pluginManager
.
loadAllPlugins
()
self
.
userlist
=
{
}
self
.
data
=
""
self
.
set_terminator
(
"
\r\n
"
)
self
.
data
=
b
""
self
.
set_terminator
(
b
"
\r\n
"
)
self
.
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
if
self
.
config
[
"
use_ssl
"
].
lower
().
startswith
(
"
y
"
):
...
...
@@ -182,13 +185,11 @@ class IRC(asynchat.async_chat):
def
_getData
(
self
):
ret
=
self
.
data
self
.
data
=
''
self
.
data
=
b
""
return
ret
def
found_terminator
(
self
):
data
=
self
.
_getData
()
print
(
"
HI
"
)
print
(
str
(
words
))
data
=
self
.
_getData
().
decode
(
"
utf-8
"
)
words
=
data
.
split
(
"
"
)
if
words
[
0
]
==
"
PING
"
:
# The server pinged us, we need to pong or we'll be disconnected
...
...
@@ -223,7 +224,7 @@ class IRC(asynchat.async_chat):
elif
words
[
1
]
==
"
353
"
:
#user list, if it's large, we only got part of it.
words
=
[
k
for
k
in
data
.
replace
(
"
=
"
,
""
).
split
(
"
"
)
if
k
!=
''
]
words
=
[
k
for
k
in
str
(
data
)
.
replace
(
"
=
"
,
""
).
split
(
"
"
)
if
k
!=
''
]
if
self
.
userlist
.
get
(
words
[
3
],
None
)
is
None
:
self
.
userlist
[
words
[
3
]]
=
[]
...
...
@@ -310,6 +311,7 @@ class IRC(asynchat.async_chat):
def
handle_connect
(
self
):
self
.
config
[
"
ident
"
]
=
ident
=
self
.
config
[
"
ident
"
]
if
self
.
config
[
"
ident
"
]
!=
""
else
self
.
config
[
"
nickname
"
]
self
.
sendLine
(
"
USER
"
+
ident
+
"
* * *
"
)
if
self
.
config
[
"
srpass
"
]
!=
""
:
self
.
sendLine
(
"
PASS
"
+
self
.
config
[
"
srpass
"
])
self
.
sendLine
(
"
NICK
"
+
self
.
config
[
"
nickname
"
])
def
handle_disconnect
(
self
):
...
...
@@ -321,9 +323,9 @@ class IRC(asynchat.async_chat):
def
sendLine
(
self
,
line
):
print
(
"'"
+
line
+
"'"
)
if
line
.
endswith
(
"
\r\n
"
):
self
.
push
(
line
)
self
.
push
(
bytes
(
line
,
"
utf_8
"
)
)
else
:
self
.
push
(
line
+
"
\r\n
"
)
self
.
push
(
bytes
(
line
+
"
\r\n
"
,
"
utf_8
"
)
)
def
doMessage
(
self
,
channel
,
message
):
self
.
sendLine
(
"
PRIVMSG
"
+
channel
+
"
:
"
+
message
)
...
...
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