Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
marvin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
legacy-projekte
marvin
Commits
f434dc97
Commit
f434dc97
authored
14 years ago
by
Oliver
Browse files
Options
Downloads
Patches
Plain Diff
IRC handling Code in eine Klassenstruktur ueberfuehrt. Noch nicht fertig.
parent
8e43ad3f
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
bin/ircbridge/wzirc.py
+49
-0
49 additions, 0 deletions
bin/ircbridge/wzirc.py
with
49 additions
and
0 deletions
bin/ircbridge/wzirc.py
0 → 100644
+
49
−
0
View file @
f434dc97
import
socket
import
message
class
Wzirc
:
# Settings
HOST
=
'
irc.freenode.org
'
#HOST='127.0.0.1'
PORT
=
6667
NICK
=
'
marvins_ircbride
'
IDENT
=
'
ircbridge
'
REALNAME
=
'
marvin
'
OWNER
=
'
warpzone
'
CHANNELINIT
=
'
#warpzone
'
rb
=
''
s
=
''
dgbmode
=
False
;
def
__init__
(
self
,
ringbuffer
):
self
.
rb
=
ringbuffer
self
.
s
=
socket
.
socket
();
# Create a TCP Socket
s
.
connect
((
self
.
HOST
,
self
.
PORT
))
#Connect to server
self
.
ircLoop
()
def
enableIrcDebug
(
self
):
self
.
dbgmode
=
Tru
def
ircLoop
(
self
):
# Connect to the Server
self
.
s
.
send
(
'
NICK
'
+
self
.
NICK
+
'
\n
'
)
#Send the nick to server
self
.
s
.
send
(
'
USER
'
+
self
.
IDENT
+
'
'
+
self
.
HOST
+
'
blub :
'
+
self
.
REALNAME
+
'
\n
'
)
#send the identification
# Enter the main LOOP
while
1
:
line
=
self
.
s
.
recv
(
1024
)
#recieve server messages - 1KB
if
self
.
dbgmode
:
print
line
if
line
.
find
(
'
End of /MOTD command.
'
)
!=-
1
:
# The connection stuff was sent. Join the channel.
self
.
s
.
send
(
'
JOIN
'
+
self
.
CHANNELINIT
+
'
\n
'
)
if
line
[
0
:
4
]
==
'
PING
'
:
#If server pings then anser with pong to keep connection alive
pong
=
'
PONG
'
+
line
[
5
:
len
(
line
)]
+
'
\n
'
if
self
.
dbgmode
:
print
pong
self
.
s
.
send
(
pong
)
#message Handling here
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