Facebook chat needs push/pop
Posted by Andrew
I’m not usually the guy who sits at the back and complains about other people’s work which far exceeds mine, but I do have something which might add to Facebook chat. Now apart from the obvious problems that Facebook has with tracking the presence of its users and the incompatibility with many Facebook users’ browsing patterns and the chat presence system, Facebook chat is pretty cool. Not all of my friends are IM types, and sometimes you just want to casually chat, so it’s pretty cool feature. There is, however something I’d like to pull in from the IM world into Facebook chat is a concept called Push/Pop.
Push/pop is a programming concept, probably best explained by someone else. I am yet to find someone who doesn’t explain it using programmer talk, so I’ll try to see what I can do. Imagine you write messages on slips of paper, and put them in a stack (key word here). Now you want to manipulate that stack. The two most common operations you would do would be to push (to add something to the stack) and pop to take something off the stack (generally the same end that you pushed to). So if we think about our stack of paper, say I write something like “I do not like green eggs and ham” and push it to the stack, then I push another slip of paper that says “I do not like them sam I am”. Then I walk away for a bit, and I want to go back to my last slip of paper, which I pop off the stack.
Now that is totally overly simplified, and yet still long-winded, but I hope you get an idea. Here it is for the visual people:

So all that (and what a wonderful drawing it is), to get to what I’d actually like to do…
So how do you take this to Facebook chat and make it useful? Lets look at how other chat applications have done it. I use irssi for IRC and it has a reasonable implementation, quite typical to chat. By default, ever line you send in irssi (basically everything you say) is pushed to the stack. You can easily pop it back out by pressing the up arrow. You can also move further through the stack by pressing the up arrow more. You can manually push a line you haven’t sent by pressing the down arrow. It can be popped out the normal way, using the up arrow. Simple, no?
Another application that does push/pop well is Adium, the IM client I use. I’m not going to explain how it works with words, I’ll let NSLog()’s Erik explain, with the help of David Clark:
- Your friend sends you a message (i.e. “How do you properly kill an NSTimer?”)
- You start a long-ish reply (i.e. “You have to invali”)
- They send you another message which requires a shorter response (i.e. “Is it cold there?”)
- You press ctrl-s, which temporarily stores your long-ish message on a stack and clears the message field.
- You reply with a short message (i.e. “Hell yeah!”)
- You press ctrl-s, and your unfinished message reappears! You finish typing “date it and then make sure you do with the memory what needs to be done - release it, assign nil, whatever.”)
Now with pictures…

Here I press ctrl-s, or ctrl-down

And then send that message and press ctrl-s again, or ctrl-down

Adium also has the ability to interact with a stack of already sent messages, by using the option-up/option-down combination.
Now this shouldn’t be too hard to implement in Facebook chat, and considering their problems with presence detection and the way people pop on and offline and messages don’t make it due to all sorts of issues, I can definitely see a use for push/pop in Facebook chat. The fact is, I wrote this whole article because I saw how it would fit in nicely.
In terms of implementation, well hopefully Facebook’s developers can handle a simple array to use as a stack (probably using JSON or similar to keep things persistent between pages) and then the keyboard shortcuts can be implemented using something like this jquery implementation.
Did I miss something?
Update: Peter Hosey asked me if I used Adium for Facebook chat (Adium had this feature as of the 1.3 release). The answer is I did for a time, but suffered from logout bugs and other issues which lead me to switch back to the traditional option. Now I have more time to submit bug reports and help troubleshoot, I may look into using Adium again, but it doesn’t remove the need for push/pop in Facebook chat. There are users other than myself who don’t use any other IM software, and also I don’t always have Adium to hand, for example when I am on a public/borrowed computer.


