Location: PHPKode > scripts > Miranda IM Database Reader > miranda-im-database-reader/Readme_EN.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Miranda IM Database Reader</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
body {
    margin: 5px;
    background-color: #FFFFFF;
    color: #000000;
    font-family: Arial, "ËÎÌå";
    font-size: 100%;
}

td {
    padding-right: 2ex;
    background: #FFFFFF;
    text-align: right;
    font-size: 100%;
}

a {
    color: #004080;
    text-decoration: none;
}

a:visited {
    color: #800080;
    text-decoration: none;
}

a:hover {
    color: #FF0000;
    text-decoration: underline;
}

h1 {
    margin-bottom: 0.5ex;
    color: #006699;
    font-size: large;
    font-weight: bold;
}

h2 {
    margin-bottom: 0.5ex;
    color: #006699;
    font-size: medium;
    font-weight: bold;
}

pre {
    padding: 1ex;
    border: 1px solid #999999;
    background-color: #EEEEEE;
    color: #000000;
    font-family: Fixedsys, "BitStream Vera Sans Mono";
}

.header_title {
    margin-bottom: 0.2em;
    text-align: center;
    font-size: x-large;
    font-weight: bold;
}

.header_subtitle {
    text-align: center;
    line-height: 2.5ex;
    font-size: small;
}

.synopsis {
    border: 1px solid #999999;
    padding: 1ex;
    max-width: 100%;
    font-family: Fixedsys, "BitStream Vera Sans Mono";
}
</style>
</head>
<body>
<div class="header_title">Miranda IM Database Reader</div>
<div class="header_subtitle">
    Current version: <b>0.01.0</b>, Last updated: <b>04/01/2006</b><br>
    Wudi &lt;<a href="mailto:wudicgi&#64;yahoo&#46;de">wudicgi-at-yahoo.de</a>&gt;, <a href="http://spaces.msn.com/wudicgi" target="_blank">MSN Space</a>
</div>
<br>
<h1>NAME</h1>
<p>Miranda IM Database Reader</p>
<h1>SYNOPSIS</h1>
<div class="synopsis">
<span style="color: #008080; font-family: Fixedsys;">// Exports all chat history</span><br />
<span style="color: #FF8000;">$export</span><span style="color: #000000;"> = </span><span style="color: #0000FF;">array</span><span style="color: #000000;">()</span><span style="color: #000000;">;</span><br />
<span style="color: #FF8000;">$MIMDBReader</span><span style="color: #000000;"> = </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> MIMDBReader()</span><span style="color: #000000;">;</span><br />
<span style="color: #FF8000;">$MIMDBReader</span><span style="color: #000000;">-&gt;open</span><span style="color: #000000;">(</span><span style="color: #808080;">'profile.dat'</span><span style="color: #000000;">);</span><br />
<span style="color: #FF8000;">$contacts</span><span style="color: #000000;"> = </span><span style="color: #FF8000;">$MIMDBReader</span><span style="color: #000000;">-&gt;getAllContacts();</span><br />
<span style="color: #0000FF;">foreach</span><span style="color: #000000;"> (</span><span style="color: #FF8000;">$contacts</span><span style="color: #000000;"> </span><span style="color: #0000FF;">as</span><span style="color: #000000;"> </span><span style="color: #FF8000;">$c_offset</span><span style="color: #000000;"> =&gt; </span><span style="color: #FF8000;">$contact</span><span style="color: #000000;">) {</span><br />
<span style="color: #000000;">&nbsp; &nbsp; </span><span style="color: #FF8000;">$export</span><span style="color: #000000;">[] = </span><span style="color: #FF8000;">$contact</span><span style="color: #000000;">[</span><span style="color: #808080;">'settings'</span><span style="color: #000000;">][</span><span style="color: #FF8000;">$contact</span><span style="color: #000000;">[</span><span style="color: #808080;">'protocol'</span><span style="color: #000000;">]][</span><span style="color: #808080;">'Nick'</span><span style="color: #000000;">] . </span><span style="color: #808080;">' ('</span><span style="color: #000000;"> . </span><span style="color: #FF8000;">$contact</span><span style="color: #000000;">[</span><span style="color: #808080;">'protocol'</span><span style="color: #000000;">] . </span><span style="color: #808080;">')'</span><span style="color: #000000;">;</span><br />
<span style="color: #000000;">&nbsp; &nbsp; </span><span style="color: #FF8000;">$export</span><span style="color: #000000;">[] = </span><span style="color: #808080;">''</span><span style="color: #000000;">;</span><br />
<span style="color: #000000;">&nbsp; &nbsp; </span><span style="color: #FF8000;">$events</span><span style="color: #000000;"> = </span><span style="color: #FF8000;">$MIMDBReader</span><span style="color: #000000;">-&gt;getEventsAfterOffset(</span><span style="color: #FF8000;">$contact</span><span style="color: #000000;">[</span><span style="color: #808080;">'offsets'</span><span style="color: #000000;">][</span><span style="color: #808080;">'firstEvent'</span><span style="color: #000000;">]);</span><br />
<span style="color: #000000;">&nbsp; &nbsp; </span><span style="color: #0000FF;">foreach</span><span style="color: #000000;"> (</span><span style="color: #FF8000;">$events</span><span style="color: #000000;"> </span><span style="color: #0000FF;">as</span><span style="color: #000000;"> </span><span style="color: #FF8000;">$event</span><span style="color: #000000;">) {</span><br />
<span style="color: #000000;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #FF8000;">$export</span><span style="color: #000000;">[] = date(</span><span style="color: #808080;">'Y-m-d H:i:s'</span><span style="color: #000000;">, </span><span style="color: #FF8000;">$event</span><span style="color: #000000;">[</span><span style="color: #808080;">'timestamp'</span><span style="color: #000000;">]) . </span><span style="color: #808080;">' '</span><span style="color: #000000;"> . ((</span><span style="color: #FF8000;">$event</span><span style="color: #000000;">[</span><span style="color: #808080;">'flags'</span><span style="color: #000000;">]==</span><span style="color: #FF0000;">2</span><span style="color: #000000;">)?</span><span style="color: #808080;">'Sent'</span><span style="color: #000000;">:</span><span style="color: #808080;">'Recv'</span><span style="color: #000000;">) .&nbsp; </span><span style="color: #808080;">' '</span><span style="color: #000000;"> . </span><span style="color: #FF8000;">$event</span><span style="color: #000000;">[</span><span style="color: #808080;">'text'</span><span style="color: #000000;">];</span><br />
<span style="color: #000000;">&nbsp; &nbsp; </span><span style="color: #000000;">}</span><br />
<span style="color: #000000;">&nbsp; &nbsp; </span><span style="color: #FF8000;">$export</span><span style="color: #000000;">[] = </span><span style="color: #808080;">''</span><span style="color: #000000;">;</span><br />
<span style="color: #000000;">}</span><br />
<span style="color: #000000;">file_put_contents</span><span style="color: #000000;">(</span><span style="color: #808080;">'export.txt'</span><span style="color: #000000;">, implode(</span><span style="color: #808080;">&quot;\r\n&quot;</span><span style="color: #000000;">, </span><span style="color: #FF8000;">$export</span><span style="color: #000000;">));</span><br />
</div>
<h1>DESCRIPTION</h1>
<p>MIM DB Reader is a PHP class that allows you to read the database of Miranda IM. So you can get some useful information such as contact settings and chat history.</p>
<h1>CLASS METHODS</h1>
<h2>bool open ( string filename )</h2>
<p>Opens a database file (and read the header). Returns TRUE on success, or FALSE on failure.</p>
<h2>array getHeader ( )</h2>
<p>Returns the header of database.</p>
<pre>array(
&nbsp;&nbsp;signature => signature of struct (Miranda ICQ DB\x00\x1A)
&nbsp;&nbsp;version => version of database (this version is 0x00000700)
&nbsp;&nbsp;ofsFileEnd => offset of the end of the database
&nbsp;&nbsp;slackSpace => the space that have been wasted
&nbsp;&nbsp;contactCount => number of contacts
&nbsp;&nbsp;ofsFirstContact => offset of the first contact
&nbsp;&nbsp;ofsUser => 
&nbsp;&nbsp;ofsFirstModule => offset of the first module
)</pre>
<h2>array getModuleByOffset ( int offset )</h2>
<p>Returns module by offset.</p>
<pre>array(
&nbsp;&nbsp;signature => signature of struct (0x4DDECADE)
&nbsp;&nbsp;ofsNext => offset of the next module
&nbsp;&nbsp;cbModuleName => length of the module name
&nbsp;&nbsp;moduleName => module name
)</pre>
<h2>array getContactByOffset ( int offset )</h2>
<p>Returns contact by offset.</p>
<pre>array(
&nbsp;&nbsp;signature => signature of struct (0x43DECADE)
&nbsp;&nbsp;ofsNext => offset of the next contact
&nbsp;&nbsp;ofsFirstSettings => offset of the first settings
&nbsp;&nbsp;eventCount => number of events
&nbsp;&nbsp;ofsFirstEvent => offset of the first event
&nbsp;&nbsp;ofsLastEvent => offset of the last event
&nbsp;&nbsp;ofsFirstUnreadEvent => offset of the first unread event
&nbsp;&nbsp;timestampFirstUnread => timestamp of the first unread event
)</pre>
<h2>array getContactSettingsByOffset ( int offset )</h2>
<p>Returns contact settings by offset.</p>
<pre>array(
&nbsp;&nbsp;signature => signature of struct (0x53DECADE)
&nbsp;&nbsp;ofsNext => offset of the next contact settings
&nbsp;&nbsp;ofsModule => offset of the module which owns this settings
&nbsp;&nbsp;cbBlob => length of the blob
&nbsp;&nbsp;settings => settings that read from the blob, array (key=>value)
)</pre>
<h2>array getEventByOffset ( int offset )</h2>
<p>Returns event by offset.</p>
<pre>array(
&nbsp;&nbsp;signature => signature of struct (0x45DECADE)
&nbsp;&nbsp;ofsPrev => offset of the previous event
&nbsp;&nbsp;ofsNext => offset of the next event
&nbsp;&nbsp;ofsModule => offset of the module which owns this event
&nbsp;&nbsp;timestamp => timestamp of the event
&nbsp;&nbsp;flags => the flag of the event (sent or read)
&nbsp;&nbsp;eventType => module-defined event type
&nbsp;&nbsp;cbBlob => length of the blob
&nbsp;&nbsp;blob => the blob (module-defined formatting)
)</pre>
<h2>array getAllContacts ( )</h2>
<p>Returns all of the contacts.</p>
<pre>array(
&nbsp;&nbsp;array(
&nbsp;&nbsp;&nbsp;&nbsp;protocol => name of the module which owns this contact
&nbsp;&nbsp;&nbsp;&nbsp;offsets => array(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;contact => offset of the contact
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nextContact => offset of the next contact
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;firstEvent => offset of the first event
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lastEvent => offset of the last event
&nbsp;&nbsp;&nbsp;&nbsp;),
&nbsp;&nbsp;&nbsp;&nbsp;settings => array( // contact settings
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;module1 => array(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key1 => value1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key2 => value2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;module2 => array(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key1 => value1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key2 => value2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...
&nbsp;&nbsp;&nbsp;&nbsp;)
&nbsp;&nbsp;),
&nbsp;&nbsp;...
)</pre>
<h2>array getEventsAfterOffset ( )</h2>
<p>Returns the events of a contact after the specified offset.</p>
<pre>array(
&nbsp;&nbsp;array(
&nbsp;&nbsp;&nbsp;&nbsp;ofsEvent => offset of the event
&nbsp;&nbsp;&nbsp;&nbsp;ofsModule => offset of the module which owns this event
&nbsp;&nbsp;&nbsp;&nbsp;timestamp => timestamp of the event
&nbsp;&nbsp;&nbsp;&nbsp;flags => the flag of the event (sent or read)
&nbsp;&nbsp;&nbsp;&nbsp;type => module-defined event type
&nbsp;&nbsp;&nbsp;&nbsp;text => the text of the event (module-defined formatting,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;only read the string before the first character NUL)
&nbsp;&nbsp;),
&nbsp;&nbsp;...
)</pre>
<h1>HISTORY</h1>
<h2>v0.01.0 (04/01/2006)</h2>
<ul type="square">
<li> The first public alpha version</li>
</ul>
<h1>AUTHOR</h1>
<p>2006, Wudi &lt;<a href="mailto:wudicgi&#64;yahoo&#46;de">wudicgi-at-yahoo.de</a>&gt;, <a href="http://spaces.msn.com/wudicgi" target="_blank">MSN Space</a></p>
<br>
</body>
</html>
Return current item: Miranda IM Database Reader