added new session alert event and lua api function

Ignore-this: a5f80b3bab3c1f812c4733697fe0f6d2

This will color a session tab red when an alert event is fired and the current tab selected
is not the same session.

This allows apps to alert the user that something happened in a session they are not looking at.

darcs-hash:20140115233258-c21fe-d1ba561db1f2e7d64d096b7181a07a64d6cdbfac
chat app now tells you when nobody is connected

Ignore-this: bee79fa1f59210326ff8a69ac50c8917

darcs-hash:20140115234924-c21fe-cb9c0fbb6909a137f8246107e13a79a14c0c997d
the tcp connection test functions now use state only

Ignore-this: 7d890d68d5550a035f3e47d618ca5e30

using the state from the state machine instead of the socket info.
If the socket closes, the state should be updated anyway correctly.
This will make it easier to find connection bugs.

darcs-hash:20140115235003-c21fe-263dcd1befb968a2e2158f19c82c5cb20427ab2c
added checks for disconnected state so that operations in tcp queue can quit early

Ignore-this: 77dbbd685460c5b4b0a3905bc2c28787

darcs-hash:20140116000518-c21fe-d21933d3f2abe12f2a15846a2b3d2e3e64ddcf33
changed from poll to run in tcp thread

Ignore-this: 373f981e8ffc9f0ec04f2f4e3c559dbe

reduced cpu load..

darcs-hash:20140116041703-c21fe-89ecd0a568a5a111e5fb5b0024a2297f1a49ccc3