Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def connect(self):
- """Connect to the IRC network and join the appropriate channels"""
- # irc.debug = 1
- self.joinedchannels = False
- try:
- if 'ssl' in self.regex and self.regex['ssl'] == '1':
- cssl = True
- else:
- cssl = False
- if 'port' in self.regex:
- cport = int(self.regex['port'])
- else:
- cport = 6667
- if 'username' in self.regex:
- username = self.regex['username']
- else:
- username = None
- if 'password' in self.regex:
- password = self.regex['password']
- else:
- password = None
- out('INFO',"Connecting to the server: %s on port: %s SSL: %s" %(self.regex['server'],cport,cssl),site=self.name)
- if self.creds.has_key('tempbotnick'):
- botnick = self.creds['tempbotnick']
- else:
- botnick = self.creds['botnick']
- if self.name != 'waffles':
- self.connection.connect(self.regex['server'], cport, botnick, password, username, self.creds['username'], ssl=cssl)
- # kwargs = {'ircname':self.creds['username'], 'ssl':cssl}
- # thread.start_new_thread(self.connection.connect,(self.regex['server'], cport, botnick),kwargs)
- elif self.name == 'waffles':
- self.connection.connect(self.regex['server'], cport, self.creds['ircallowednick'], password, username, self.creds['username'], ssl=cssl)
- except irclib.ServerConnectionError, e:
- out('ERROR',e,site=self.name)
- time.sleep(3)
- except irclib.ServerNotConnectedError, e:
- out('ERROR',e.message(),site=self.name)
- time.sleep(3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement