Saturday, April 28, 2012

GSoC: The start of something ....

Okay, this is a little late considering the list of accepted proposals was published on Tuesday (Monday for some), but I've been a little busy with Uni work lately.

So, I think drdanz covered the official description of my project in his blog, which was to
"...create a completely asynchronous modular and extensible system that enriches messages before they’re displayed to the user. These includes embedding images and videos from links, Translating messages, (re)-formatting them nicely, reading out loud etc."

Let me go into a bit of detail on what that actually means. Let's take for example the the Image plugin in Kopete: when a user sends a link to an image it downloads downloads, scales and embeds the image directly in the chat window. Before my friends found out about this and abused it (and even afterwards when they eventually got bored of it), this was a very useful plugin. It made the conversation much more interesting to look at (instead of being a dull wall of text and timestamps), and it meant that most times I didn't have to actually click on it and open a browser to see what they meant.

I wanted this functionality in KTp, so I quickly tweaked/hacked the code that processes incomming messages in ktp-text-ui to stick the link in an <img> tag. So the end result looked like this:
And a another screenshot here.

I apologize for all the memes, but they're the only 2 screenshots I have of it and I honestly don't have the time to search through all the branches in all the clone/scratch repos to look for that code again.

But suffice to say, it had a few drawbacks like the fact that you couldn't disable them. And the code consisted mostly of a hack, so it clearly wasn't in a state to ship. 

Rather than keeping it in a branch and rebase-ing after every update so it stays just for me, I thought I may as well do this properly and make something useful for everyone.

Thus the idea of a plugin based Message Filter system was born. 
I noticed that there were quite a few things that would be useful for a text-ui to do besides just embed images. A lot of clients like gtalk and facebook do embed things to make their chat more interesting for people. 

So, inspired by the them and the existing plugins in Kopete, I came up with a list of 'filters' I could build. (I'm copy-pasting this list straight from my proposal - if the people reviewing it could understand what they meant, I'm sure you guys can ;-)
  • Web Integration 
    • Bookmarks - automatically make bookmarks of recieved links
    • Image - embed previews of links to images in chat
    • YouTube - embed or generate previews for youtube links in chat
    • Bugzilla - (or other KDE specific stuff) show title and description of link to bug
    • Wikipedia - Embed first paragraph (and image) from links to Wikipedia
    • Description - Embed title and image (like facebook and google+ does when sharing) of an any incoming link.
    • Mailto - Replace email addresses in messages with appropriate mailto: links.
  • Accessibility
    • Translator - translates incoming and outgoing messages to predefined languages
    • Jouvie plugin - option to automatically read out messages
  • Extensibility
    • Pipes - pipe messages through external program
    • Auto-Replace plugin - replace user defined keywords in messages
    • Search Commands - replaces commands like ‘lmgtfy:dbus tubes’ with ‘’ before sending.
  • Enhanced Display
    • Highlight - highlight messages based on criteria
    • Latex - renders incoming latex in window 
    • GTalk Formatting - turn “_this_ -or- *this*” into “this or this”

Right, I have some stuff working so far, which I'll blog about later. So hopefully by the end of this project your chat window would be much more 'enriched'.

PS: Feel free to suggest some relatively easy that could be added to that list. (On the off chance that I might finish early).

Thursday, February 2, 2012

The Hunt for Unobtrusive Chat

Once apon a time, Instant messaging or 'Online Chat' was a primary task on it's own. That is, I remember the days when I would switch on my computer, sign in to 'MSN Messenger' (as it was called back then), have a voice conversation with my father (who was working in England at the time), and then be done with it. However, over the last few years, not only have we started to rely more on it, but it's also become more of a secondary (or even tertiary) task. For example, these days I keep in contact with the rest of the telepathy-kde (or is it kde-telepathy now, or just 'ktp' yet?) team on IRC while I'm developing; talk to my friends (with a steam voice call) while playing a game and so on.

The thing is that, things like that need to be able to be done simultaneously while still maintaining maximum efficiency. Which becomes painfully impossible when you have to switch windows, or the way most IM clients are implemented these days.

So, shortly before joining the Telepathy-KDE team, I set out to figure out what would allow me to talk to someone while doing my work with the minimum overhang (interruptions).

First off, switching windows:
If someone talks to me while I'm typing away at something, and the only way I can respond to them is using my mouse (which would involve moving my hands away from my keyboard, clicking on something and then moving back), I will eventually start slicing my wrists.
So, it has to be a global shortcut with a hotkey.
The best example I've seen of that is Kopete:
     Whenever I saw this Icon on my system tray, I would know someone has said something to me. I hit Ctrl + Shift + I and it would take me to the chat window of that person.

I press it again, and it goes to the next person that said something. I keep doing that till I've responded to everyone.

Now, that was brilliant at propagating a conversation and talking to many people at once. But it still had the problem that once I've responded to everyone, switching back to my work was a pain. Granted, I tried to keep my work in a different virtual desktop (and these days Plasma Activities might handle this reasonably well). But that just wasn't good enough for me as it meant I had to waste time managing all the chat windows and switching desktops.

Next Up: Out of the way
I don't like having a window open just to talk to one person, and having one window with tabs for multiple people is even worse (IMHO). A conversation needs to be easily visible, but not be the main focus of my screen - that should be whatever I'm working on at the time.
Best example of that I've seen is in Gmail: when I check my emails, I can have conversations with my Google Talk contacts at the bottom.

These things were brilliant as they meant my conversations were on-screen, but not hogging up the screen. The problem with them were that they were in the browser, and switching tabs or to another window meant they would go away and were very painful to find again.

So, it will have to sit in my panel, probably as a popup widget.

Right, with those two important points in mind, I set out actually creating a solution.
Here, you can see the (very) early (not quite ready for testing) test version of the plasmoid. Currently, it's implemented as a TelepathyTextObserver, which means that the standard text-ui has to be open for it to work, which makes it rather useless. I'll probably change that in the future, but I'm still waiting on a method to be implemented in Telepathy-Qt to allow for two text handlers to play nice with each other.
If that doesn't magically implemented by someone, I'll probably ship this as a handler meaning if the user has this in their desktop, then the standard text-ui won't show up at all ever.
My original idea was to have this only handle a specific set of contacts (i.e. everyone in your 'Favourites' group) and open the normal text-ui for the rest. This also gave me the idea of having single-user plasmoids, that will be there from the start and handle all message to/from that user, thus effectively allowing you to 'pin' a contact to your panel.

And as you can see in this screenshot, if there are unread messages in a conversation, a little bubble will appear telling how many (just like facebook). I couldn't find any plasma theme element that's in any way logical for it, so for now it's hardcoded red and white. If any plasma devs have any ideas, let me know.

Also, just like kopete, clicking Ctrl + Shift + J (I'll make it configurable when I figure out how) will pop up the next conversation with unread messages. And if you were already at the last one, they'll all go away, leaving you back to your work. 

The last part was that I wanted it to feel tightly 'integrated' so I tried to make it look like the task-manager applet. While it may look like I succeed (to a certain degree) in that screenshot, the moment you use it, you'll notice it behaves differently. As it turns out the task-manager widget is quite complex and not something I can easily reproduce in QML. I have to either wait for the plasma team to eventually port it to QML or make a C++ extension and steal their code. 

So, what do you guys think? 
PS: This is my first 'real' contribution to KDE, so please go easy on your (constructive) criticism. :-)

Wednesday, September 21, 2011


This is my first post (ever) in a blog, so I really don't know what I'm doing here. Hopefully, one day it will contain loads of interesting stuff to read (especially for a KDE audience) but for now, just bear with me :)

I'm a first year university student (still in the ZOMG UNI phase ;-) studying Software Engineering at the University of New South Wales. If you haven't heard of it, it's probably because it's in Australia - that place 'down under' that people keep joking about... involving a Crocodile Dundee, foster's beer (though I hadn't even heard of it until I went to the UK) and Neighbors.
Yes Neighbors -
while everyone I know hates it, I was recently informed that soap opera fans in England love it. :-/

Anywho, that's enough rambling for now, I created this blog due to the extreme peer pressure during the Woshibon sprint. But I had issues remembering who manged the DNS for my domain, and took a while to get this set up, so I'll write up the stuff I remember (just the awesome bits) from it soon.