FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Installation Issues » Forcing New Line at Beginning of Signature for News Group Post?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Forcing New Line at Beginning of Signature for News Group Post? [message #159627] Sat, 13 June 2009 13:06 Go to next message
jm2morri is currently offline  jm2morri   Canada
Messages: 225
Registered: January 2009
Location: Stratford, Ontario, Canad...
Karma: 0
Senior Member
I have noticed that if a user doesn't end there message with a blank line that the signature that gets appended to the message when uploaded to an nntp server doesn't start on a new line.

I think this should be forced in. Can someone point me to the file that I'd need to add that in? I imagine it would be relatively easy to do if I knew where to do it.

James.
Re: Forcing New Line at Beginning of Signature for News Group Post? [message #159629 is a reply to message #159627] Sat, 13 June 2009 13:58 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Will this help:

Index: imsg_edt.inc.t
===================================================================
RCS file: /forum21/install/forum_data/src/imsg_edt.inc.t,v
retrieving revision 1.177
diff -u -r1.177 imsg_edt.inc.t
--- imsg_edt.inc.t      29 Apr 2009 20:34:12 -0000      1.177
+++ imsg_edt.inc.t      13 Jun 2009 13:57:43 -0000
@@ -544,7 +544,7 @@
                                define('sql_p', '{SQL_TABLE_PREFIX}');

                                $lock = $nntp->get_lock();
-                               $nntp->post_message($mtf->subject, $body.$nntp_adm->custom_sig, $from, $mtf->id, $replyto_id, $attach);
+                               $nntp->post_message($mtf->subject, $body."\n".$nntp_adm->custom_sig, $from, $mtf->id, $replyto_id, $attach);
                                $nntp->close_connection();
                                $nntp->release_lock($lock);
                        } else {


Please let me know so we can update the CVS repository.
Re: Forcing New Line at Beginning of Signature for News Group Post? [message #159632 is a reply to message #159629] Sat, 13 June 2009 20:31 Go to previous messageGo to next message
jm2morri is currently offline  jm2morri   Canada
Messages: 225
Registered: January 2009
Location: Stratford, Ontario, Canad...
Karma: 0
Senior Member
naudefj wrote on Sat, 13 June 2009 09:58
Will this help:

Index: imsg_edt.inc.t
===================================================================
RCS file: /forum21/install/forum_data/src/imsg_edt.inc.t,v
retrieving revision 1.177
diff -u -r1.177 imsg_edt.inc.t
--- imsg_edt.inc.t      29 Apr 2009 20:34:12 -0000      1.177
+++ imsg_edt.inc.t      13 Jun 2009 13:57:43 -0000
@@ -544,7 +544,7 @@
                                define('sql_p', '{SQL_TABLE_PREFIX}');

                                $lock = $nntp->get_lock();
-                               $nntp->post_message($mtf->subject, $body.$nntp_adm->custom_sig, $from, $mtf->id, $replyto_id, $attach);
+                               $nntp->post_message($mtf->subject, $body."\n".$nntp_adm->custom_sig, $from, $mtf->id, $replyto_id, $attach);
                                $nntp->close_connection();
                                $nntp->release_lock($lock);
                        } else {


Please let me know so we can update the CVS repository.



Maybe. Do I need to do anything after I make that change? Like rebuild something or other?

James.

Re: Forcing New Line at Beginning of Signature for News Group Post? [message #159633 is a reply to message #159632] Sat, 13 June 2009 20:42 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Yes, you need to rebuild your themes.
Re: Forcing New Line at Beginning of Signature for News Group Post? [message #159634 is a reply to message #159633] Sat, 13 June 2009 20:48 Go to previous messageGo to next message
jm2morri is currently offline  jm2morri   Canada
Messages: 225
Registered: January 2009
Location: Stratford, Ontario, Canad...
Karma: 0
Senior Member
naudefj wrote on Sat, 13 June 2009 16:42
Yes, you need to rebuild your themes.


The patch works perfectly for me. Just what the doctor ordered.

James.
Re: Forcing New Line at Beginning of Signature for News Group Post? [message #159755 is a reply to message #159634] Fri, 19 June 2009 23:29 Go to previous messageGo to next message
jm2morri is currently offline  jm2morri   Canada
Messages: 225
Registered: January 2009
Location: Stratford, Ontario, Canad...
Karma: 0
Senior Member
jm2morri wrote on Sat, 13 June 2009 16:48
naudefj wrote on Sat, 13 June 2009 16:42
Yes, you need to rebuild your themes.


The patch works perfectly for me. Just what the doctor ordered.

James.



Oops, I spoke too soon. The signature delimiter needs to be "-- ", in other words "dash" "dash" "space". With this patch the "space" is missing.

I'm working on trying to fix that but no joy so far.

James.
Re: Forcing New Line at Beginning of Signature for News Group Post? [message #159756 is a reply to message #159755] Fri, 19 June 2009 23:47 Go to previous messageGo to next message
jm2morri is currently offline  jm2morri   Canada
Messages: 225
Registered: January 2009
Location: Stratford, Ontario, Canad...
Karma: 0
Senior Member
I _think_ what might be going on here is in the file src/imsg_edt.inc around line 787 in 2.8:

$body = $mtf->body . (($mtf->msg_opt & 1 && $mtf->sig) ? "\n-- \n" . $mtf->sig : '');
$body = plain_text($body, '{TEMPLATE: post_html_quote_start_p1}', '{TEMPLATE: post_html_quote_start_p2}', '{TEMPLATE: post_html_quote_end}');


I don't really know what I'm doing, but my thought is that the function plain_text() is removing trailing spaces from lines (which would normally be OK). But it would then remove the space behind the two dashes and thus nntp clients don't recognise the signature.

I think the easiest solution would be to convert to plain text and then prepend the signature. So basically flip the two lines, more or less.

Any comments?

James.

Re: Forcing New Line at Beginning of Signature for News Group Post? [message #159762 is a reply to message #159756] Sun, 21 June 2009 01:54 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Why don't you try it and let us know if it solves the problem? Just remember to plain_text() the signature as well.

Should I back-out the patch against imsg_edt.inc.t?
Re: Forcing New Line at Beginning of Signature for News Group Post? [message #159772 is a reply to message #159762] Mon, 22 June 2009 11:50 Go to previous message
jm2morri is currently offline  jm2morri   Canada
Messages: 225
Registered: January 2009
Location: Stratford, Ontario, Canad...
Karma: 0
Senior Member
naudefj wrote on Sat, 20 June 2009 21:54
Why don't you try it and let us know if it solves the problem? Just remember to plain_text() the signature as well.

Should I back-out the patch against imsg_edt.inc.t?


Hi Frank,

I figured out what was going on. I have added a prefix of "-- " to the newsgroup signature. But then that goes through the plain_text() filter and the trailing space is removed.

But that is not the right way to do it. In nntp any signature should always start with the standard "-- " so I changed the line in imsg_edt.inc.t to

$nntp->post_message($mtf->subject, $body." \n-- \n".$nntp_adm->custom_sig, $from, $mtf->id, $replyto_id, $attach);


So that it is always generated with this signature. I suppose a more generic solution would be to only add the "-- " if there was a signature but for me there always will be so it's not a problem.

Then the news group sig that the admin enters doesn't need to worry about this and it all works fine.

Cheers,

James.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Still no Umlaut in Dates with 2.8.1
Next Topic: Admin control center broken after upgrade
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 06:27:03 GMT 2024

Total time taken to generate the page: 0.03962 seconds