summaryrefslogtreecommitdiff
path: root/plugins/YammerImport/yamdump.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-09-21 14:56:20 -0700
committerBrion Vibber <brion@pobox.com>2010-09-28 07:44:20 -0700
commit7a81bc371309aee0d45dfcec35466557cc6a1ba1 (patch)
treed70ee461b748f5e8d754f4a4c676bffa2cc41955 /plugins/YammerImport/yamdump.php
parent599f4fe121f41629a1760b205747e6aec7f72fee (diff)
YammerImport: initial processing code for users, groups, and messages
Diffstat (limited to 'plugins/YammerImport/yamdump.php')
-rw-r--r--plugins/YammerImport/yamdump.php33
1 files changed, 31 insertions, 2 deletions
diff --git a/plugins/YammerImport/yamdump.php b/plugins/YammerImport/yamdump.php
index 953b7d1a6..ad739760a 100644
--- a/plugins/YammerImport/yamdump.php
+++ b/plugins/YammerImport/yamdump.php
@@ -25,7 +25,36 @@ $data = $yam->messages();
// 2) we'll need to pull out all those referenced items too?
// 3) do we need to page over or anything?
-foreach ($data['messages'] as $message) {
- $notice = $imp->messageToNotice($message);
+// 20 qualifying messages per hit...
+// use older_than to grab more
+// (better if we can go in reverse though!)
+// meta: The older-available element indicates whether messages older than those shown are available to be fetched. See the older_than parameter mentioned above.
+
+foreach ($data['references'] as $item) {
+ if ($item['type'] == 'user') {
+ $user = $imp->prepUser($item);
+ var_dump($user);
+ } else if ($item['type'] == 'group') {
+ $group = $imp->prepGroup($item);
+ var_dump($group);
+ } else if ($item['type'] == 'tag') {
+ // could need these if we work from the parsed message text
+ // otherwise, the #blarf in orig text is fine.
+ } else if ($item['type'] == 'thread') {
+ // Shouldn't need thread info; we'll reconstruct conversations
+ // from the reply-to chains.
+ } else if ($item['type'] == 'message') {
+ // If we're processing everything, then we don't need the refs here.
+ } else {
+ echo "(skipping unknown ref: " . $item['type'] . ")\n";
+ }
+}
+
+// Process in reverse chron order...
+// @fixme follow paging
+$messages = $data['messages'];
+array_reverse($messages);
+foreach ($messages as $message) {
+ $notice = $imp->prepNotice($message);
var_dump($notice);
}