def loadlast(self,recipent,style,me): import datetime now=datetime.datetime.now() day=now.strftime("%d-%m-%Y") path=self.workpath+"/"+recipent filepath=path+"/"+day+".txt" try: f = open(filepath, "r") text=f.read() text=text.split("\n") html="" last="" if len(text)>15: i=len(text)-10 else: i=0 for y in range(i,len(text)-1): line=text[y].split("|") if line[1]==last: continous=True else: continous=False last=line[1] if line[1]=="!ME!": outgoing=True line[1]=me else: outgoing=False html=html+set_archstyle(line[0],line[1],line[2],outgoing=outgoing,continous=continous,style=style) except: html="" #html=set_emoticons("riceballs",html) return html
def get_html(self,day,recipent,me): if day==None or day=="Brak rozmów": html="<center> Brak rozmów w archiwum" else: path=self.workpath+"/"+recipent filepath=path+"/"+day f = open(filepath, "r") lines=f.readlines() f.close() f=open(mpath+"/chatstyles/default/Template.html") html=f.read() f.close() #html="" last="" # c=len(lines) #lines.remove(c) for i in lines: line=i.split("|") if line[1]==last: continous=True else: continous=False last=line[1] if line[1]=="!ME!": outgoing=True line[1]=me else: outgoing=False html=html+set_archstyle(line[0],line[1],line[2],outgoing=outgoing,continous=continous,style="default",archive=True) #html=html.replace(chr(13),"<br/>") # html=html.replace("\n","<br/>") #if not "<font size=-3> html="<font size=-3>"+html return html