http://tinyurl.com/", "
"); return "http://tinyurl.com/$tinyurl"; } function XMLtime2UNIX($timestamp) { //example timestamp 2007-12-20T14:42:16-06:00 //note: this is only accurate to the nearest minute. doesn't compute seconds in the ret timestamp. //date $d1 = explode("T", $timestamp); $d1_e = explode("-", $d1[0]); $d_year = $d1_e[0]; $d_month = $d1_e[1]; $d_day = $d1_e[2]; //time $d2_e = explode(":", $d1[1]); $t_hour = $d2_e[0]; $t_minute = $d2_e[1]; return mktime($t_hour, $t_minute, 0, $d_month, $d_day, $d_year); } function updateNick() { $handle = fopen("c:\\nowplaying.xml", "r"); $data = fread($handle, filesize("c:\\nowplaying.xml")); $title = getNeedleBetween($data, "",""); $artist = getNeedleBetween($data, "",""); $length = getNeedleBetween($data, ""); $s_timestamp = XMLtime2UNIX(getNeedleBetween($data, "")); $newstatus = "(8)$title - $artist(8)"; if((time() - $s_timestamp) > ($length + 60)) { $newstatus = "^_^"; } $find_window = @mb_SysGetProcAddr('user32.dll','FindWindowA'); $get_window_text = @mb_SysGetProcAddr('user32.dll','GetWindowTextA'); $hWND = @mb_SysCallProc($find_window,'Valve001',0); if($hWND > 0) { $malloc = @mb_SysMalloc(2048); $window_text = @mb_SysCallProc($get_window_text,$hWND,$malloc,2048); $window_title = @mb_SysGetString($malloc); mt_setvar('isgaming', "1"); } else { if(mt_getvar('isgaming') == "1") { mb_PSetMyStatus("AIM", ID_STATUS_ONLINE); mb_PSetMyStatus("MSN", ID_STATUS_ONLINE); mb_PSetMyAwayMsg("MSN", $newstatus); } mt_setvar('isgaming', "0"); } if(mt_getvar('isgaming') == "1") { $newstatus = "Playing a game: $window_title"; mb_PSetMyStatus("AIM", ID_STATUS_AWAY); mb_PSetMyStatus("MSN", ID_STATUS_OCCUPIED); mb_PSetMyAwayMsg("MSN", $newstatus); mb_PSetMyAwayMsg("AIM", $newstatus); mt_setvar('status', $newstatus, 1); echo($newstatus."\n"); } elseif(mt_getvar('status') != $newstatus) { mb_PSetMyAwayMsg("MSN", $newstatus); mt_setvar('status', $newstatus, 1); echo($newstatus."\n"); } fclose($handle); } function mbe_MsgIn($cid,$body,$timestamp,$known) { if(strip_tags($body) == "mbe_ShutDown") { $cid_uin = mb_CGetUIN($cid); mb_MsgSend($cid, "Fuck you too, $cid_uin"); return 0; } if(substr(strip_tags($body), 0, 11) == "maketinyurl") { $url = substr(strip_tags($body), 11); $tinyurl_url = tinyurl($url); mb_MsgSend($cid, "TinyURL for $url: $tinyurl_url"); return 0; } if(substr(strip_tags($body), 0, 8) == "LLsearch") { $searchterm = urlencode(substr(strip_tags($body), 9)); $page = cURLget("http://luelinks.net/links.php?s_aw=$searchterm&mode=as&go=Search"); $first_result_tr = getNeedleBetween($page, "", ""); $result = getNeedleBetween($first_result_tr, "linkme.php?l=", "\">"); if(is_numeric($result)) { mb_MsgSend($cid, "LUElinks result for $searchterm: http://luelinks.net/linkme.php?l=$result"); } else { mb_MsgSend($cid, "No results on LUElinks for $searchterm"); } } return 0; } function mbot_load() { global $status; $status = array(); //here we'll register our handler; mb_SelfRegister(MB_EVENT_MSG_IN,1); mt_setvar('status', "^_^", 1); mt_setvar('isgaming', "0", 1); updateNick(); mb_SchReg("StatusUpdater", "*/1 * *", "updateNick", 1, 0); // update after every 1 minute (*/1 * *) } ?>