Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.81 KB | None | 0 0
  1.  
  2.     def connect(self):
  3.         """Connect to the IRC network and join the appropriate channels"""
  4. #        irc.debug = 1
  5.         self.joinedchannels = False
  6.         try:
  7.             if 'ssl' in self.regex and self.regex['ssl'] == '1':
  8.                 cssl = True
  9.             else:
  10.                 cssl = False
  11.             if 'port' in self.regex:
  12.                 cport = int(self.regex['port'])
  13.             else:
  14.                 cport = 6667
  15.             if 'username' in self.regex:
  16.                 username = self.regex['username']
  17.             else:
  18.                 username = None
  19.             if 'password' in self.regex:
  20.                 password = self.regex['password']
  21.             else:
  22.                 password = None
  23.             out('INFO',"Connecting to the server: %s on port: %s SSL: %s" %(self.regex['server'],cport,cssl),site=self.name)
  24.             if self.creds.has_key('tempbotnick'):
  25.                 botnick = self.creds['tempbotnick']
  26.             else:
  27.                  botnick = self.creds['botnick']
  28.             if self.name != 'waffles':
  29.                 self.connection.connect(self.regex['server'], cport, botnick, password, username, self.creds['username'], ssl=cssl)
  30. #                kwargs = {'ircname':self.creds['username'], 'ssl':cssl}
  31. #                thread.start_new_thread(self.connection.connect,(self.regex['server'], cport, botnick),kwargs)
  32.             elif self.name == 'waffles':
  33.                self.connection.connect(self.regex['server'], cport, self.creds['ircallowednick'], password, username, self.creds['username'], ssl=cssl)
  34.         except irclib.ServerConnectionError, e:
  35.             out('ERROR',e,site=self.name)
  36.             time.sleep(3)
  37.         except irclib.ServerNotConnectedError, e:
  38.             out('ERROR',e.message(),site=self.name)
  39.             time.sleep(3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement