MCPcopy Index your code
hub / github.com/pyload/pyload / process

Method process

module/plugins/hoster/XDCC.py:489–592  ·  view source on GitHub ↗
(self, pyfile)

Source from the content-addressed store, hash-verified

487
488
489 def process(self, pyfile):
490 server = self.info['pattern']['SERVER']
491 chan = self.info['pattern']['CHAN']
492 bot = self.info['pattern']['BOT']
493 pack = self.info['pattern']['PACK']
494
495 temp = server.split(':')
496 ln = len(temp)
497 if ln == 2:
498 host, port = temp[0], int(temp[1])
499
500 elif ln == 1:
501 host, port = temp[0], 6667
502
503 else:
504 self.fail(_("Invalid hostname for IRC Server: %s") % server)
505
506 nick = self.config.get('nick')
507 nick_pw = self.config.get('nick_pw')
508 ident = self.config.get('ident')
509 realname = self.config.get('realname')
510 invite_opts = [_x.split('/')
511 for _x in self.config.get('invite_opts').strip().split(',')
512 if len(_x.split('/')) == 4]
513
514 #: Remove leading '#' from channel name
515 for opt in invite_opts:
516 if opt[1].startswith('#'):
517 opt[1] = opt[1][1:]
518
519 #: Change request type
520 self.req.close()
521 self.req = self.pyload.requestFactory.getRequest(self.classname, type="XDCC")
522
523 self.pyfile.setCustomStatus("connect irc")
524
525 self.irc_client = IRC(self, nick, ident, realname)
526 for _i in xrange(0, 3):
527 try:
528 if self.irc_client.connect_server(host, port):
529 try:
530 if nick_pw:
531 self.irc_client.nickserv_identify(nick_pw)
532
533 for opt in invite_opts:
534 if opt[0].lower() == host.lower() and opt[1].lower() == chan.lower():
535 self.irc_client.send_invite_request(opt[2], opt[1], opt[3])
536 break
537
538 if not self.irc_client.join_channel(chan):
539 self.fail(_("Cannot join channel"))
540
541 if not self.irc_client.is_bot_online(bot):
542 self.fail(_("Bot is offline"))
543
544 self.pyfile.setStatus("waiting")
545
546 self.irc_client.xdcc_request_pack(bot, pack)

Callers

nothing calls this directly

Calls 15

process_irc_commandMethod · 0.95
splitMethod · 0.80
getRequestMethod · 0.80
setCustomStatusMethod · 0.80
connect_serverMethod · 0.80
nickserv_identifyMethod · 0.80
send_invite_requestMethod · 0.80
join_channelMethod · 0.80
is_bot_onlineMethod · 0.80
setStatusMethod · 0.80
xdcc_request_packMethod · 0.80
disconnect_serverMethod · 0.80

Tested by

no test coverage detected