Reads a struct of type from offset offset. If offset parameter is not specified, the class will read it from current position.
When full parameter is set to FALSE, the variable-length part (such as moduleName, settings chain, and event's blob) will not be read. In this way, you can save much time when doing a search or the result need not to be cached.
See chapter Structs for information about the structs.
Returns the read struct on success, or throws MimDbHandler_Exception on failure.
Example 2.1. An example that exports all the chat history
<?php include_once 'mimdb_handler.php'; $local_encoding = 'GBK'; // only available for database used in Miranda IM >= 0.5 $export = array(); $handler = new MimDbHandler(); $handler->open('profile.dat', TRUE); $header =& $handler->getHeader(); $contacts =& $handler->getContacts($header['ofsFirstContact']); $fp = fopen('export.txt', 'wb'); foreach ($contacts as $c_offset => &$contact) { $contents = ''; $settings =& $handler->getSettings($contact['ofsFirstSettings']); $protocol = $settings['Protocol']['settings']['p']->value; if (isset($settings[$protocol]['settings']['Nick'])) { $setting_nick =& $settings[$protocol]['settings']['Nick']; $nickname = $setting_nick->value; if ($setting_nick->type == MimDbHandler::DB_VARIANT_TYPE_UTF8) { mb_convert_variables($local_encoding, 'UTF-8', $nickname); } } else { $nickname = '(no name)'; } $contents = "$nickname ($protocol)\r\n\r\n"; $events =& $handler->getEvents($contact['ofsFirstEvent']); foreach ($events as &$event) { if ($pos = strpos($event['blob'], "\x00")) { $text = substr($event['blob'], 0, $pos); } else { $text = $event['blob']; } $contents .= date('Y-m-d H:i:s', $event['timestamp']) . ' '; $contents .= ($event['flags']==MimDbHandler::DB_EVENT_FLAG_SENT) ? 'Sent' : 'Recv'; $contents .= ": $text\r\n"; } $contents .= "\r\n\r\n"; fwrite($fp, $contents); } fclose($fp); echo 'Completed.'; ?>