Guest User

Untitled

a guest
Jun 21st, 2017
518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. <?php
  2. //+------------------------------------------------------------------+
  3. //| This simple mBot Miranda Script is for all DBox Lovers out there |
  4. //| it just forwards incomming messages to the Dbox if the box is on |
  5. //| Just add your DBox IP in the Configuration Section below and the |
  6. //| Script is ready to go ! |
  7. //| |
  8. //| Version 0.0.3 - 28.08.2006 s.H.A.D |
  9. //| Version 0.0.4 - 02.09.2006 cyrus2401 |
  10. //| Version 0.0.5 - 02.09.2006 cyrus2401 |
  11. //+------------------------------------------------------------------+
  12. ;######## Begin der Konfiguration ###############################
  13.  
  14. $dbox_ip = "192.168.0.3"; // Dbox IP
  15. $dbox_htuser = ""; // Webuser
  16. $dbox_htpass = ""; // Webpass
  17.  
  18. $restriction_status = array(ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_DND, ID_STATUS_OCCUPIED);
  19. $restriction_proto = "ICQ"; // Protokoll bei dem der Status gecheckt wird
  20. $hideMsg = false; // Nur informieren, nicht Nachricht darstellen
  21.  
  22.  
  23. /*
  24. // Zustände bei denen nichts gesendet wird, mögliche Eingaben
  25. ID_STATUS_OFFLINE
  26. ID_STATUS_ONLINE
  27. ID_STATUS_AWAY
  28. ID_STATUS_DND
  29. ID_STATUS_NA
  30. ID_STATUS_OCCUPIED
  31. ID_STATUS_FREECHAT
  32. ID_STATUS_INVISIBLE
  33. ID_STATUS_ONTHEPHONE
  34. ID_STATUS_OUTTOLUNCH
  35. ID_STATUS_IDLE
  36. */
  37.  
  38. ;######## Ende der Konfiguration ################################
  39.  
  40. function mbot_load(){
  41. mb_SelfRegister(MB_EVENT_MSG_IN,1);
  42. }
  43.  
  44.  
  45.  
  46.  
  47. function mbe_MsgIn($cid,$body,$timestamp,$known) {
  48. global $dbox_ip, $dbox_htuser, $dbox_htpass, $restriction_awayMsg, $restriction_status, $restriction_proto, $away_msg, $hideMsg;
  49.  
  50. if(is_array($restriction_status) && count($restriction_status) > 0) {
  51. $status = mb_PGetMyStatus($restriction_proto);
  52. if(in_array($status, $restriction_status))
  53. return 0;
  54. }
  55.  
  56.  
  57. $fp = fsockopen($dbox_ip, 80, $errno, $errstr, 1);
  58. if (!$fp) {
  59. mb_echo("DBox ist nicht an\n");
  60. return 0;
  61. }else{
  62.  
  63. // Kontakt Name holen
  64. $CDisplayName = mb_CGetDisplayName($cid);
  65.  
  66. // Nachricht wird erstellt
  67. $body = $CDisplayName.": ".$body;
  68.  
  69. //Zeilenumbruch
  70. $body = wordwrap($body, 50, chr(10));
  71.  
  72. //umlaute formatieren
  73. $body = text_encode($body);
  74.  
  75. // für den webtransport formatieren
  76. $body = urlencode($body);
  77.  
  78. // nur Informieren
  79. if($hideMsg)
  80. $body = "Neue Nachricht";
  81.  
  82. // Variablenname hinzufügen
  83. $body = "popup=".$body;
  84.  
  85. $urlString = "GET /control/message?$body HTTP/1.1\r\nHost: $dbox_ip\r\nConnection: Keep-Alive\r\nUser-Agent: MBot\r\n";
  86. if ($dbox_htuser)
  87. $urlString .= "Authorization: Basic ".base64_encode("$dbox_htuser:$dbox_htpass")."\r\n";
  88.  
  89. $urlString .= "\r\n";
  90.  
  91. // debug informationen
  92. //mb_echo("sende zu D-box: ".$urlString."\n$dbox_htuser:$dbox_htpass\n");
  93.  
  94. // und ab gehts auf die Dbox
  95. fputs($fp, $urlString);
  96.  
  97. // debug informationen
  98. $response = fgets($fp);
  99. //mb_echo("Antwort: $response\n");
  100.  
  101. fclose($fp);
  102. return 0;}
  103.  
  104. }
  105.  
  106.  
  107. function text_encode ($body){
  108.  
  109. $body = str_replace ("ä", "%c3%a4", $body);
  110. $body = str_replace ("ö", "%c3%b6", $body);
  111. $body = str_replace ("ü", "%c3%bc", $body);
  112. $body = str_replace ("Ä", "%C3%84", $body);
  113. $body = str_replace ("Ö", "%C3%96", $body);
  114. $body = str_replace ("Ü", "%C3%9C", $body);
  115. $body = str_replace ("ß", "%C3%9F", $body);
  116.  
  117. return $body;
  118. }
  119. ?>
Add Comment
Please, Sign In to add comment