aMSN Forums
October 21, 2018, 11:09:12 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: New forum for aMSN !!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: GTK frontend  (Read 9246 times)
arantes
Super Power User
**
Offline Offline

Posts: 364



View Profile
« on: August 22, 2009, 05:39:23 pm »

Could you please read this piece of code from the current GTK frontend :
Code:

    def __print_chat(self, nick, msg, sender):
        html = '<div>'
        if (self.last_sender != sender):
            html += '<span style="%s">%s</span><br/>' % (self.nickstyle,
                nick)
        html += '<span style="%s">[%s] %s</span></div>' % (self.msgstyle,
            time.strftime('%X'), msg)

        self.textview.display_html(html)
        self.textview.scroll_to_bottom()


The frontend checks by itself if the last sender is the sender of this message and decides by itself not to show the nickname. I think it doesn't match with the "dumb front end" we want, does it ?
Shouldn't we change this ?

EDIT : I wonder if it wouldn't be better to create a chatview that the core will manage. It will then send a whole HTML page of the current chat to the frontend instead of sending only the message. Or would it be less efficient since it would pass the whole page every time ?  What do you think ?
Logged
kakaroto
Administrator
Super Power User
*****
Offline Offline

Posts: 9428


View Profile WWW
« Reply #1 on: August 23, 2009, 03:25:29 am »

you're right, eventually, it should be moved into the core...
about passng the whole html text, no... it would quickly become bad in terms of memory and speed...  it would mean we'd need to keep a in memory copy of all the text chats, and recreate them in html, then pass it to the front end, which itself will need to reparse the whole thing... forget it.. especially if you plan on having a multiuser chat with 10 people and chat for 5 hours with them...
not ever front end would support html (think about curses for example), so the core shouldn't just decide on using that.. however, it would be nice to have the front end tell the core whether ot not it supports it... especially since we want to have Adium chat themes support in amsn2... in that case, maybe the core should do it differently... anyways the design is stil changing a lot...
Logged

KaKaRoTo
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!