コード例 #1
0
ファイル: main.py プロジェクト: supercoeus/toxygen
 def run(self):
     # initializing callbacks
     init_callbacks(self.tox, self.ms, self.tray)
     # bootstrap
     try:
         for data in node_generator():
             if self.stop:
                 return
             self.tox.bootstrap(*data)
             self.tox.add_tcp_relay(*data)
     except:
         pass
     for _ in range(10):
         if self.stop:
             return
         self.msleep(1000)
     while not self.tox.self_get_connection_status():
         try:
             for data in node_generator():
                 if self.stop:
                     return
                 self.tox.bootstrap(*data)
                 self.tox.add_tcp_relay(*data)
         except:
             pass
         finally:
             self.msleep(5000)
コード例 #2
0
 def run(self):
     # initializing callbacks
     init_callbacks(self.tox, self.ms, self.tray)
     # bootstrap
     try:
         for data in node_generator():
             if self.stop:
                 return
             self.tox.bootstrap(*data)
     except:
         pass
     for _ in xrange(10):
         if self.stop:
             return
         self.msleep(1000)
     while not self.tox.self_get_connection_status():
         try:
             for data in node_generator():
                 if self.stop:
                     return
                 self.tox.bootstrap(*data)
         except:
             pass
         finally:
             self.msleep(5000)
コード例 #3
0
ファイル: sunucu.py プロジェクト: yusufgogus50/milisia-tox
def init(loop):
    app = web.Application(loop=loop)
    app.router.add_route('GET', '/', root)
    app.router.add_route('GET', '/sm/{arkadasno}', sendMessage)
    app.router.add_route('GET', '/df/{arkadasno}', deleteFriend)
    app.router.add_route('GET', '/lf/{toxid}', listFiles)
    app.router.add_route('GET', '/dugumler', dugumler)
    app.router.add_route('POST', '/dps_baglan', dps_baglan)
    app.router.add_route('GET', '/guncelle', guncelle)
    app.router.add_route('GET', '/dps', dps)
    app.router.add_route('GET', '/mesajlasma', mesajlasma)
    app.router.add_static("/static", './static')
    aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader('./templates'))
    srv = yield from loop.create_server(app.make_handler(), '127.0.0.1', 7001)
    print("Web sunucusu http://127.0.0.1:7001 başlatıldı.")
    init_callbacks(tox)
    # bootstrap
    print("bootstrap dugumlerine baglanıyor...")
    for data in node_generator():
        tox.bootstrap(*data)
    tox.self_set_name("milis-toxia-" + sonek)
    tox.self_set_status_message("Milis Toxia")
    asyncio.Task(toxloop())
    asyncio.Task(paysun())
    return srv
コード例 #4
0
ファイル: sunucu.py プロジェクト: milisarge/milisia
def init(loop):
	app = web.Application(loop=loop)
	app.router.add_route('GET', '/', root)
	app.router.add_route('GET', '/sm/{arkadasno}', sendMessage)
	app.router.add_route('GET', '/df/{arkadasno}', deleteFriend)
	app.router.add_route('GET', '/lf/{toxid}', listFiles)
	app.router.add_route('GET', '/dugumler', dugumler)
	app.router.add_route('POST', '/dps_baglan', dps_baglan)
	app.router.add_route('GET', '/guncelle', guncelle)
	app.router.add_route('GET', '/dps', dps)
	app.router.add_route('GET', '/mesajlasma', mesajlasma)
	app.router.add_static("/static",'./static')
	aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader('./templates'))
	srv = yield from loop.create_server(app.make_handler(),'127.0.0.1', 7001)
	print("Web sunucusu http://127.0.0.1:7001 başlatıldı.")
	init_callbacks(tox)
	# bootstrap
	print ("bootstrap dugumlerine baglanıyor...")
	for data in node_generator():
		tox.bootstrap(*data)
	tox.self_set_name("milis-toxia-"+sonek)
	tox.self_set_status_message("Milis Toxia")
	asyncio.Task(toxloop())
	asyncio.Task(paysun())
	return srv
コード例 #5
0
ファイル: main.py プロジェクト: milisarge/toxfs
	def main(self):
		self.tox = tox_factory(ProfileHelper.open_profile(self.path))
		print self.tox.self_get_address()
		init_callbacks(self.tox)
		sonek=str(self.tox.self_get_address())[0:2]
		com_file="gelen_komutlar"+sonek
		# bootstrap
		for data in node_generator():
			self.tox.bootstrap(*data)
		settings = Settings()
		self.profile = Bot(self.tox)
		self.tox.self_set_name("Toxfs_Agent-0.1"+sonek)
		self.tox.self_set_status_message("Tox File Sharing Agent")
		for num in self.tox.self_get_friend_list():
			print num,self.tox.friend_get_name(self.tox.self_get_friend_list()[num])
		print 'Iterate'
		try:
			while not self.stop:
				self.tox.iterate()
				time.sleep(self.tox.iteration_interval() / 1000.0)
				if os.path.exists(com_file) and '##' in open(com_file,"r").read():
					print com_file,"isleniyor..."
					data=open(com_file,"r").read()
					datalar=data.split('##')
					arkadasno=datalar[0]
					islemtip=datalar[1]
					param=datalar[2]
					param2=datalar[3]
					print "gelen ",islemtip,":",arkadasno,islemtip,param,param2
					if self.tox.friend_get_connection_status(int(arkadasno)):
						if islemtip=="mesaj":
							self.tox.friend_send_message(int(arkadasno),0,param)
							print arkadasno,self.tox.friend_get_name(int(arkadasno)),"arkadasa metin mesaji gonderildi."
						if islemtip=="komut":
							self.tox.friend_send_message(int(arkadasno),0,param2)
							print arkadasno,self.tox.friend_get_name(int(arkadasno)),"arkadasa komut mesaji gonderildi."
					print com_file,"siliniyor."
					os.remove(com_file)
					print com_file,"tamamlandi."
                
		except KeyboardInterrupt:
			settings.save()
			data = self.tox.get_savedata()
			ProfileHelper.save_profile(data)
			del self.tox
		print "test"
コード例 #6
0
ファイル: main.py プロジェクト: yashssonani/filebot
 def main(self):
     self.tox = tox_factory(ProfileHelper.open_profile(self.path))
     init_callbacks(self.tox)
     # bootstrap
     for data in node_generator():
         self.tox.bootstrap(*data)
     settings = Settings()
     self.profile = Bot(self.tox)
     print 'Iterate'
     try:
         while not self.stop:
             self.tox.iterate()
             time.sleep(self.tox.iteration_interval() / 1000.0)
     except KeyboardInterrupt:
         settings.save()
         data = self.tox.get_savedata()
         ProfileHelper.save_profile(data)
         del self.tox
コード例 #7
0
ファイル: main.py プロジェクト: ingvar1995/filebot
 def main(self):
     self.tox = tox_factory(ProfileHelper.open_profile(self.path))
     init_callbacks(self.tox)
     # bootstrap
     for data in node_generator():
         self.tox.bootstrap(*data)
     settings = Settings()
     self.profile = Bot(self.tox)
     print 'Iterate'
     try:
         while not self.stop:
             self.tox.iterate()
             time.sleep(self.tox.iteration_interval() / 1000.0)
     except KeyboardInterrupt:
         settings.save()
         data = self.tox.get_savedata()
         ProfileHelper.save_profile(data)
         del self.tox