Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //+------------------------------------------------------------------+
- //| This simple mBot Miranda Script is for all DBox Lovers out there |
- //| it just forwards incomming messages to the Dbox if the box is on |
- //| Just add your DBox IP in the Configuration Section below and the |
- //| Script is ready to go ! |
- //| |
- //| Version 0.0.3 - 28.08.2006 s.H.A.D |
- //| Version 0.0.4 - 02.09.2006 cyrus2401 |
- //| Version 0.0.5 - 02.09.2006 cyrus2401 |
- //+------------------------------------------------------------------+
- ;######## Begin der Konfiguration ###############################
- $dbox_ip = "192.168.0.3"; // Dbox IP
- $dbox_htuser = ""; // Webuser
- $dbox_htpass = ""; // Webpass
- $restriction_status = array(ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_DND, ID_STATUS_OCCUPIED);
- $restriction_proto = "ICQ"; // Protokoll bei dem der Status gecheckt wird
- $hideMsg = false; // Nur informieren, nicht Nachricht darstellen
- /*
- // Zustände bei denen nichts gesendet wird, mögliche Eingaben
- ID_STATUS_OFFLINE
- ID_STATUS_ONLINE
- ID_STATUS_AWAY
- ID_STATUS_DND
- ID_STATUS_NA
- ID_STATUS_OCCUPIED
- ID_STATUS_FREECHAT
- ID_STATUS_INVISIBLE
- ID_STATUS_ONTHEPHONE
- ID_STATUS_OUTTOLUNCH
- ID_STATUS_IDLE
- */
- ;######## Ende der Konfiguration ################################
- function mbot_load(){
- mb_SelfRegister(MB_EVENT_MSG_IN,1);
- }
- function mbe_MsgIn($cid,$body,$timestamp,$known) {
- global $dbox_ip, $dbox_htuser, $dbox_htpass, $restriction_awayMsg, $restriction_status, $restriction_proto, $away_msg, $hideMsg;
- if(is_array($restriction_status) && count($restriction_status) > 0) {
- $status = mb_PGetMyStatus($restriction_proto);
- if(in_array($status, $restriction_status))
- return 0;
- }
- $fp = fsockopen($dbox_ip, 80, $errno, $errstr, 1);
- if (!$fp) {
- mb_echo("DBox ist nicht an\n");
- return 0;
- }else{
- // Kontakt Name holen
- $CDisplayName = mb_CGetDisplayName($cid);
- // Nachricht wird erstellt
- $body = $CDisplayName.": ".$body;
- //Zeilenumbruch
- $body = wordwrap($body, 50, chr(10));
- //umlaute formatieren
- $body = text_encode($body);
- // für den webtransport formatieren
- $body = urlencode($body);
- // nur Informieren
- if($hideMsg)
- $body = "Neue Nachricht";
- // Variablenname hinzufügen
- $body = "popup=".$body;
- $urlString = "GET /control/message?$body HTTP/1.1\r\nHost: $dbox_ip\r\nConnection: Keep-Alive\r\nUser-Agent: MBot\r\n";
- if ($dbox_htuser)
- $urlString .= "Authorization: Basic ".base64_encode("$dbox_htuser:$dbox_htpass")."\r\n";
- $urlString .= "\r\n";
- // debug informationen
- //mb_echo("sende zu D-box: ".$urlString."\n$dbox_htuser:$dbox_htpass\n");
- // und ab gehts auf die Dbox
- fputs($fp, $urlString);
- // debug informationen
- $response = fgets($fp);
- //mb_echo("Antwort: $response\n");
- fclose($fp);
- return 0;}
- }
- function text_encode ($body){
- $body = str_replace ("ä", "%c3%a4", $body);
- $body = str_replace ("ö", "%c3%b6", $body);
- $body = str_replace ("ü", "%c3%bc", $body);
- $body = str_replace ("Ä", "%C3%84", $body);
- $body = str_replace ("Ö", "%C3%96", $body);
- $body = str_replace ("Ü", "%C3%9C", $body);
- $body = str_replace ("ß", "%C3%9F", $body);
- return $body;
- }
- ?>
Add Comment
Please, Sign In to add comment