BitlBee Script

By CadetAndrew on Jun 07, 2011

This is a script for BitlBee. BitlBee is an IRC platform that allows you to connect with all social networks right inside your IRC client! More information is in the script itself.

This script here will enhance your BitlBee experience!

Any questions or problems? You can ask me here, or visit my IRC channel #Andrew on GameSurge.

; =========================================================================================
; Bitlbee.mrc by Andrew
; Version 1.0.3

; ================ Introduction: ====================
; This script will echo to your active channel, and show tooltips for the following:
; - When a user signs in anywhere
; - When a user signs out anywhere
; - When a user goes idle
; - When a user returns from idle

; =============== Usage: ============================
; First, you will need to set up an account on one of the BitlBee networks.
; For a list of networks you can connect to, visit:
; http://www.bitlbee.org/main.php/servers.html

; When you have eonnected to one of the networks, change your nick to what you want to log in as
; then say "register <password>" in the &bitlbee channel to make your account.

; Now you need to add accounts. To do this, use:
; account add <protocol> <account>
; Valid protocols are:
; Jabber, MSN, OSCAR (AIM/ICQ), Yahoo and Twitter
; Example:
; account add yahoo foobar
; account
; Next you need to enter your password for that account, to do this type:
; /oper <account> <password>

; Example:
; /oper foobar foobarpass

; If you encounter any problems with BitlBee or this script, feel free to chat with me on:
; irc.gamesurge.net #Andrew

; ================== Configuration: ========================

; Do you use a specific nick on BitlBee? If you do change this variable below, otherwise just leave it blank. Your nick will not be changed if nothing is here.
; Note: for auto-login it will use your current nick ($me) to OPER using %bbpasswors set below.
set %bbnick $me

; Set this to your BitlBee password. If you leave this variable empty auto-login will be disabled.
set %bbpassword 
; ================== End of configuration ==========================

; == Auto nick change ==
on *:CONNECT:{
  if ($network == BitlBee && %bbnick !isnum) { 
    if ($me != %bbnick) { nick %bbnick }
  }
}

; == Auto login ==
on *:TEXT:*:&bitlbee:{
  if ($network == BitlBee && $5 == gateway! && %bbpass !isnum) {  
    msg &bitlbee identify 
    if (%bbnick !isnum) { oper %bbnick %bbpass }
    else { oper $me %bbpass }
  }
}

; Log in
on *:JOIN:&bitlbee:{
  set %cnck $nick
  if (%onick isnum) { set %onick 1 }
  inc %onick +1
  ; Facebook log in
  if (*.facebook.com iswm $address) { 
    BitlBeeTip $nick has just logged in to Facebook Chat
  }
  ; Yahoo log in
  elseif (yahoo iswm $address) { 
    BitlBeeTip $nick has just logged in to Yahoo Chat
  }
  ; Windows Live log in
  elseif (*.hotmail.com iswm $address || *.live.com iswm $address) { 
    BitlBeeTip $nick has just logged in to Windows Live Chat
  }
  ; Google Talk log in
  elseif (*.gmail.com iswm address) { 
    BitlbeeTip $nick has just logged in to Google Talk
  }
}

; Log out
on *:QUIT:{
  if ($network == BitlBee) { 
    ; Facebook log out
    dec %onick -1
    if (*.facebook.com iswm $address) { 
      BitlBeeTip $nick has just logged out of Facebook Chat
    }
    ; Yahoo log in
    elseif (yahoo iswm $address) { 
      BitlBeeTip $nick has just logged out of Yahoo Chat
    }
    ; Windows Live log in
    elseif (*.hotmail.com iswm $address || *.live.com iswm $address) { 
      BitlBeeTip $nick has just logged out of Windows Live Chat
    }
    ; Google Talk log in
    elseif (*.gmail.com iswm address) { 
      BitlbeeTip $nick has just logged out of Google Talk
    }
  }
}

; Away
on *:DEVOICE:&bitlbee:{
  set %dvnick $vnick
  if (%dvnicks isnum) { set %dvnicks 1 }
  inc %dvnicks +1
  BitlBeeTip $vnick is now away
}

; Return from away
on *:VOICE:&bitlbee:{
  if ($vnick != %cnick && > %dvnicks >= 1) { 
    BitlBeeTip $vnick has returned from away
    dec %dvnicks -1
  }
}

alias bitlbee {
  if ($1 == vars) { 
    echo -a Current BitlBee nick: %bbnick
    echo -a Currentl BitlBee password: %bbpass
    echo -a Variable cnick: %cnick
    echo -a Onlne nicks: %onicks
    echo -a Away nicks: %dvnicks
  }
  elseif ($1 == logout) { 
    .msg &bitlbee account off
    .timer1 1 5 BitlBeeTip You have been signed out of BitlBee
    unset %onicks
    unset %anicks
  }
  elseif ($1 == login) { 
    .msg &bitlbee identify
    oper %bbnick %bbpass
    .timer1 1 5 BitlBeeTip You have been signed in to BitlBee
  } 
  else {
    echo -a Usage: /bitlbee vars|logout|login
  }
}

alias BitlBeeTip {
  if ($tip(bitlbee)) tip -t bitlbee $+($tip(bitlbee).text, $crlf, -, $crlf, $1-)
  else noop $tip(bitlbee, BitlBee Notification, $1-, 7)
}

Comments

Sign in to comment.
CadetAndrew   -  Jul 09, 2011

Script has been updated. :)

Added new configuration settings
Added a new /bitlbee alias (vars, login, logout)
Fixed issue with auto-identify
Now uses /OPER to identify rather than msging into the channel
Added auto-nick change
Tips now use BitlBeeTip alias
Added new variables

 Respond  
CadetAndrew   -  Jun 25, 2011

I've been testing a different version of this, it has colors and different kind of text, plus twitter notifications.

@jaytea I really like your idea of checking if a tip is already up so I'll try to implement it in somehow. :)

 Respond  
jaytea   -  Jun 07, 2011

The tips also used to have different names, so everytime something different happened it would hop above the other.

as you've correctly noted, if simultaneously visible tips share the same title then the text will be combined into a single tip. i think this is a sensible way of displaying the information, but just in case you're interested there are a couple of undocumented commands that you can also use that give you more control over displayed tips:

/tip -c : close the tip with the given name
/tip -t : change the text of the given tip

for example, if you find that piling on those notifications looks cleaner if you throw in line separators, you can opt for:

alias addToTip {
  if ($tip(bitlbee)) tip -t bitlbee $+($tip(bitlbee).text, $crlf, -, $crlf, $1-)
  else noop $tip(bitlbee, BitlBee Notification, $1-, 7)
}

eg. //addToTip line1 | addToTip line2

sure you can just throw up an extra $tip( , , -, ), but this makes things a little more convenient, and perhaps you can find a more suitable use for those commands ;P

 Respond  
CadetAndrew   -  Jun 07, 2011

@napa182 BitlBee will connect you to your social networks and show all your buddies/friends in the nick list as if they were really there.

@Jethro_ It was worse before I tweaked it. It used to echo and tip both on join and voice, so everytime someone came online you would get 2 notifications right off the bat. The tips also used to have different names, so everytime something different happened it would hop above the other.

 Respond  
Jethro   -  Jun 07, 2011

This snippet may cause a certain irritability because of constant echos and balloon tips.

 Respond  
napa182   -  Jun 07, 2011

hmm i don't get what this snippet does.. from ur description: "BitlBee is an IRC platform that allows you to connect with all social networks right inside your IRC client!
you made it sound like you connect to these sites..
so this is for a server called BitlBee an really has nothing to do with connecting to facebook / yahoo / msn.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.