[pLog-svn] r1993 - plugins/trunk/moblog/class/moblog
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Wed May 11 20:55:25 GMT 2005
Author: oscar
Date: 2005-05-11 20:55:23 +0000 (Wed, 11 May 2005)
New Revision: 1993
Modified:
plugins/trunk/moblog/class/moblog/moblogrequest.class.php
Log:
a few more improvements
Modified: plugins/trunk/moblog/class/moblog/moblogrequest.class.php
===================================================================
--- plugins/trunk/moblog/class/moblog/moblogrequest.class.php 2005-05-11 20:28:24 UTC (rev 1992)
+++ plugins/trunk/moblog/class/moblog/moblogrequest.class.php 2005-05-11 20:55:23 UTC (rev 1993)
@@ -48,12 +48,23 @@
$this->_replyAddress = ($replyTo2 != "") ? $replyTo2 : $replyTo1;
}
- $this->_topic = $structure->headers['subject'];
- MoblogLogger::Log("subject is = ".$this->_topic );
-
+ // parse the body
$this->parseBody( $structure->body );
+
+ // if there was no subject specified, then let's see if there was something in the
+ // 'subject' line...
+ if( !$this->_topic ) {
+ $this->_topic = $structure->headers['subject'];
+ if( !$this->_topic ) {
+ // if there is still no subject, get the first 50 characters of the body
+ $this->_topic = substr($this->_body, 0, 50 );
+ }
+ }
+
+ MoblogLogger::Log("subject is = ".$this->_topic );
+
MoblogLogger::log( "There are ".count($structure->parts)." MIME parts available to parse" );
- $this->parseMimeParts( $structure->parts );
+ $this->parseMimeParts( $structure->parts );
}
/**
@@ -67,13 +78,11 @@
//$body = strtr($body,"\xE2\x80\xA9","\n\n\n");
$body = str_replace("\xE2\x80\xA9","\n",$body);
- MoblogLogger::log("body after filtering = $body");
-
//We try to find out where the line containing the title is at...
- /*if (preg_match("/^topic:(.*)/mi", $body, $title)) {
+ if (preg_match("/^topic:(.*)/mi", $body, $title)) {
//And put the title var in the proper place
$this->_topic = trim($title[1]);
- }*/
+ }
//We repeat the same trick as above... for all vars wanted
if (preg_match("/^user:(.*)/mi", $body, $user)) {
@@ -101,20 +110,8 @@
// ...or a blog name
if (preg_match("/^blog:(.*)/mi", $body, $blogname)) {
$this->_blogName = trim($blogname[1]);
- }
-
- // we also allow people to write 'cat' instead of 'category' if they want to...
- /*if (preg_match("/^cat:(.*)/mi", $body, $cat)) {
- $this->_category = trim($cat[1]);
- } else if (preg_match("/^category:(.*)/mi", $body, $category)) {
- $this->_category = trim($category[1]);
- }*/
+ }
- // maybe the user is requesting help...
- /*if (preg_match("/^help:(.*)/mi", $body, $help)) {
- $this->_help = trim($help[1]);
- }*/
-
//We strip out all the lines we already used, and use what's left as the body
$body = str_replace($title[0], "", $body);
$body = str_replace($user[0], "", $body);
More information about the pLog-svn
mailing list