示例#1
0
 def sendMsg(self):
     msg=self.msgInput.text
     msg=msg.strip()
     from Utils import timeString
     if self.uniq:
         data=urllib.urlencode({"msg":msg,"id":Loggers.id,"to_id":self.to_id,"tm":timeString(),"uniq":self.uniq})
     else:
         data=urllib.urlencode({"msg":msg,"id":Loggers.id,"to_id":self.to_id,"tm":timeString()})
     #url="http://m.yahyakesenek.com/kycorp/sendmsg_ky.php"
     url = "http://kymath6.coolpage.biz/sendmsg.php"
     UrlRequest(req_headers=self.headers,url=url,method="POST",req_body=data,on_success=self.localMsg,on_error=self.failed)
示例#2
0
 def localMsg(self,req,veri):
     data=json.loads(veri.decode("utf-8")) if not isinstance(veri,dict) else veri
     from Utils import timeString,timeToStr
     tm=timeString()
     if self.uniq:
         scs=data["res"]
         print scs
         if scs=="success":
             msg=self.msgInput.text.strip()
             username="******"
             color="5cacee"
             _msg = msg + "\n               [size=10][b]" + timeToStr(_mytime=tm) + "[/b][/size]"
             self.msgLabel.text += "\n[color=#%s]%s[/color] :\n %s" % (color, username, _msg)
     else:
         if data["res"]=="success":
             if data["uniq"]:
                 self.uniq=data["uniq"]
                 msg = self.msgInput.text.strip()
                 username = "******"
                 color = "5cacee"
                 _msg = msg + "\n               [size=10][b]" + timeToStr(_mytime=tm) + "[/b][/size]"
                 self.msgLabel.text += "\n[color=#%s]%s[/color] :\n %s" % (color, username, _msg)