#68 closed enhancement (fixed)
[patch] status command for changing status and status message
Reported by: | mina86 | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | BitlBee | Version: | 1.0 |
Keywords: | status command message | Cc: | |
IRC client+version: | Client-independent | Operating System: | Other |
OS version/distro: |
Description
A while ago, I've written a patch which adds a status command allowing user to change status and status message. Usage of the command is as simple as: status [<account>] <status> '<message>'
, eg.: status xa 'I am not here right now'
or status 1 online 'I am here'
. Since I use only jabber, it wasn't tested on other IM networks but should at least change the status.
The feature is quite simple and may look stupid but it is sometimes useful especialy when using transports in Jabber or connecting to bitlbee through a BNC.
--- bitlbee-1.0.orig/commands.c 2005-12-24 17:17:36.000000000 +0000 +++ bitlbee-1.0/commands.c 2005-12-24 17:32:19.000000000 +0000 @@ -51,6 +51,7 @@ { "nick", 1, cmd_nick }, { "import_buddies", 1, cmd_import_buddies }, { "qlist", 0, cmd_qlist }, + { "status", 2, cmd_status }, { NULL } }; @@ -797,3 +798,42 @@ return( 0 ); } + +int cmd_status( irc_t *irc, char **cmd ) +{ + account_t *a; + + if( cmd[3] ) + { + if( ( a = account_get( irc, cmd[1] ) ) ) + { + if( a->gc ) + { + if( a->gc->prpl && a->gc->prpl->set_away ) + a->gc->prpl->set_away( a->gc, cmd[2], cmd[3] ); + } + else + { + irc_usermsg( irc, "Account offline" ); + } + } + else + { + irc_usermsg( irc, "Invalid account" ); + } + } + else + { + if ( irc->accounts ) { + for( a = irc->accounts; a; a = a->next ) + if( a->gc && a->gc->prpl && a->gc->prpl->set_away ) + a->gc->prpl->set_away( a->gc, cmd[1], cmd[2] ); + } + else + { + irc_usermsg( irc, "No accounts known. Use 'account add' to add one." ); + } + } + + return( 0 ); +} diff -Naur bitlbee-1.0.orig/commands.h bitlbee-1.0/commands.h --- bitlbee-1.0.orig/commands.h 2005-12-24 17:17:36.000000000 +0000 +++ bitlbee-1.0/commands.h 2005-12-24 17:23:15.000000000 +0000 @@ -55,7 +55,8 @@ int cmd_nick( irc_t *irc, char **cmd ); int cmd_qlist( irc_t *irc, char **cmd ); int cmd_import_buddies( irc_t *irc, char **cmd ); -int cmd_dump( irc_t *irc, char **cmd ); +/* int cmd_dump( irc_t *irc, char **cmd ); -- why is it still here? */ +int cmd_status( irc_t *irc, char **cmd ); diff -Naur bitlbee-1.0.orig/protocols/jabber/jabber.c bitlbee-1.0/protocols/jabber/jabber.c --- bitlbee-1.0.orig/protocols/jabber/jabber.c 2005-12-24 17:17:36.000000000 +0000 +++ bitlbee-1.0/protocols/jabber/jabber.c 2005-12-24 17:32:05.000000000 +0000 @@ -1896,6 +1896,13 @@ } } + if (message) { + y = xmlnode_insert_tag(x, "status"); + char *utf8 = str_to_utf8(message); + xmlnode_insert_cdata(y, utf8, -1); + g_free(utf8); + } + gjab_send(gjc, x); xmlnode_free(x); }
Attachments (3)
Change History (31)
comment:1 Changed at 2006-01-09T11:00:22Z by
comment:2 Changed at 2006-01-11T19:49:54Z by
No, it cannot:
- you cannot set an extended away status with
/away
IRC client command; - you cannot set different statuses for different accounts;
- you cannot set a status message for online status;
- you cannot change the status message without changing the status;
- you cannot set status which you have now.
The last one may sound strange so here's what I mean: I use a tlen.pl transport (tlen.pl is a Polish IM) wchic is in beta (or something) so it sometimes does not work. However, sometimes changing a status helps and the transport connets where it should and I am online on tlen again. But I do not want to change a statu each time tlen transport does something wrong and disconnects so I just send a status
command to bitlbee with the status I have.
Changed at 2006-01-12T07:18:18Z by
Attachment: | bitlbee-1.0-status-cmd-shorter-jabber-statuses.diff added |
---|
Small patch allowing you to use xa instead of 'extended away'
comment:3 Changed at 2006-01-12T07:33:44Z by
OK, I've tested /away
a bit and yes, you can do most of the things status
does with /away
but still you cannot set different statuses for different accounts. I've also noticed that you gat an ugly looking "Extended Away - message" or "Online - message". BTW. setting an online status with /away
command is quit strang if you thing of it... Moreover, I believe I had some reason to write this patch ;) even if I cannot recall it now :P
comment:4 Changed at 2006-01-12T09:59:24Z by
Hmmm, I was planning such a command (for per-account status settings) too, but then named "account status". Although I'm not sure if that's really necessary...
But yes, except for the per-account thing the /away solution should be good enough for most people already, I think.
comment:5 Changed at 2006-01-12T19:45:10Z by
Don't forget about the ugly looking status message thing. Either /away
should somehow strip the status description (eg. "online" from "online message" string or "extended away" from "extended away message") or status
should be implemented.
BTW. If you've been planning such a command why not grab a patch someone gives you :P
Changed at 2006-01-12T19:46:30Z by
Attachment: | bitlbee-1.0-account-status-cmd.diff added |
---|
account status command with help
comment:6 Changed at 2006-02-16T08:20:13Z by
I haven't tried this patch, but I like the idea, beeing able to set an onlike status like "Working from home today" or "At the xxx branch office" would be very useful for me. But this is only supported by MSN and Jabber as far as I know, are these protocols supported by the patch?
comment:7 Changed at 2006-03-31T22:14:38Z by
Priority: | major → normal |
---|
Changed at 2006-04-13T07:28:27Z by
Attachment: | bitlbee-1.0.2-account-status-cmd.diff added |
---|
Patch for bitlbee 1.0.2
comment:8 Changed at 2007-06-06T19:29:24Z by
Thanks for this patch!
I know it's against a different version, but I'm running bitlbee 1.0.3 and the patched applied (mostly) cleanly (with the exception of doc/user-guide/help.txt)
Anyway now that I know how it works, it's working fine. I did manage to break bitlbee by giving an invalid account status, so I guess the error checking isn't very robust. If you're interested I can try to repro.
Anyway, thanks for the patch :) I hope it gets into bitlbee sometime.
comment:9 Changed at 2007-06-14T02:51:33Z by
Still happily running a patched bitlbee but now I'm thinking that it would be really cool if you could get bitlbee to do:
- blist could show you status messages for those account types (eg jabber) that support it - eg:
14:47 <@root> penny someone@… (JABBER) Online "Annoying the bitlbee developers"
- status changes in jabber of people on your blist could trigger a notification -eg:
14:47 -!- penny (something@…) has changed status to "just won't shut up with the feature requests"
That would be ACES :)
comment:10 Changed at 2007-07-01T13:16:41Z by
Actually the current devel version does this properly already! The API sucked too much in the past to pass this information properly, but now you can see the full away state+message information in /whois, blist, etc.
The info doesn't get through if the person isn't away though (impossible on IRC), but the info command should still show it.
comment:11 Changed at 2007-07-01T19:52:31Z by
Yay! That's fantastic.
Is there support for setting it as well as viewing ?
comment:12 Changed at 2007-07-01T19:59:13Z by
Hrmm.. I guess you mean no setting it unless it's from the away message?
The patch in this ticket adds support to do
'account status online "message here"' in the control channel, which sets it in jabber accounts at least.
comment:13 Changed at 2007-07-01T20:02:06Z by
/away is the only way for now. But I might add a per-account status setting. No need for an "account status" command.
comment:14 Changed at 2007-11-16T00:12:13Z by
I just installed 1.1 dev from http://kilobyte.rcac.purdue.edu/ubuntu/ and I can't see how to get status messages from /whois or blist, blist status just says 'Online' or 'Away' or 'Do not Disturb' - no message... /whois just gives me ircname and server
Is there a setting or something I need to toggle?
comment:15 Changed at 2009-01-12T21:21:17Z by
I just want to +1 an online status feature for bitlbee. It's very common nowadays to set a status message to the name of the song you are listening to, or something useful like "Be in the office after 1pm". Doing this outside of /away is a must, since you don't want to been seen as "Away", you just want a status message to be sent. I know that AIM, Jabber, and Yahoo support this.
comment:16 Changed at 2009-01-14T01:42:57Z by
I'll add my +1 as well, setting my own, and seeing the status messages of others would be very useful, and MSN supports this as well as the protocols pjones@ mentioned
comment:17 Changed at 2009-01-26T12:40:11Z by
In case anyone is still interested in my patche I keep posting newer versions on my website at http://mina86.com/2008/02/20/bitlbee-account-status/
comment:18 Changed at 2009-01-28T12:46:09Z by
Any chance of getting these patches merged into bitlbee?
comment:19 Changed at 2009-05-12T19:00:34Z by
Okay, this is what I'm thinking of doing:
Add two per-account settings: status and away (status only for the accounts that support non-away status messages).
And this is how it will behave:
a) If the account's away variable is set, use that. b) If the user is /away, use that for all accounts. c) Otherwise, use the status variable for a non-away status message.
Seems sane?
comment:20 Changed at 2009-05-12T19:05:56Z by
Sounds awesome! If the user is not away, and sets status, and then goes /away and returns, will it revert to the original non-away status?
Yay, thank you for working on this :)
comment:21 Changed at 2009-05-12T19:24:12Z by
Yes, that's *exactly* what I had in mind. Finding the right way to handle such cases is one of the reasons I was slacking on this; but I like this solution. :-)
comment:22 Changed at 2009-07-09T13:36:19Z by
I definitely support the addition of this feature into bitlbee. I, for one, use IRSSI as my IRC client, and really do not want to use /away
for IM status messages, as then I am marked away in all of the many channels I am joined to, which is annoying for others trying to talk to me.
comment:25 Changed at 2010-02-22T20:47:48Z by
Interested too, I think bitlbee should not care about irc /away states. It should rather have options like: :set status 0 'State' 'My status is this' sets the state and msg for specific account :set status_follow_irc 1 true makes it follow the irc status on specific account and maybe follows the irc status msg... preferably not but add conf option for it if you like
comment:26 Changed at 2010-02-22T22:47:55Z by
IMHO /away is the natural thing to do for a seamless mapping of IRC to IM. But yes, I want to add a global and per-account status variable for stuff like that. I was writing code for that two weeks ago but it was on a laptop that got stolen by some dishonest person (if you read this, please die a horrible death) before I could push it to any server. Will take some time to do it again later. :-/
comment:27 Changed at 2010-03-07T00:39:31Z by
This is now available on:
http://code.bitlbee.org/wilmer/status/
Will merge it into mainline soon enough. I think this is mostly ready, I just have to update the help info.
This works the way I described a few comments up. There are per-account and global settings called away and status. They're read in the order account-away, global-away, account-status, global-status. The first value that is not NULL is set. If you have a status message set and go away, the away message takes over. Once you come back, the status message is restored.
The settings are also saved so they survive restarts.
comment:28 Changed at 2010-06-15T12:00:44Z by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Merged and released a little while ago already. 1.2.5 I think.
I think this can already be done by using /AWAY. For example, /AWAY busy - I'm not here. Wilmer?