<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/16586" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2009-02-01T14:59:46-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/16586</id>

		<entry>
		<author><name><![CDATA[D3FiANC3]]></name></author>
		<updated>2009-02-01T14:59:46-04:00</updated>

		<published>2009-02-01T14:59:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87196#p87196</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87196#p87196"/>
		<title type="html"><![CDATA[Where have I gone wrong? (pubm)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87196#p87196"><![CDATA[
Thanks for all the replies.  I also appreciate the explanations to go with the code - always better to learn so next time I can do for myself.  I have fixed my errors and thrown the log line in to test it out.<br><br>The reason why my script sends the data to a php page is as you guessed, to add it to the DB.  As for why it is sent unprocessed ... well that is simply because my PHP knowledge is advanced whereas my Tcl knowledge (as you can see) is amateurish.<br><br><em class="text-italics">Edit:</em><br><br>OK, here is the amended script.<br><div class="codebox"><p>Code: </p><pre><code>package require httpbind pubm - "#mychan *released*ago*" blowmeproc blowme {nick host handle channel text} { putlog "bind triggered" set text [stripcodes bcruag $text]if {[string equal -nocase "MrBot" $nick]} {   set url "http://www.myurl.com/gotime.php?[::http::formatQuery prerls $text]"  set agent "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"  set page [::http::config -useragent $agent]  set page [::http::geturl $url] }}</code></pre></div>All is well now.  It seemed to be the $nick match.  Even though I used the same case, the match failed.  A case-insensitive match did it.  Thanks again for the help and for the education. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">  The script not only works but I feel better knowing I got rid of some of that junk also (which I knew was sloppy/wrong but I knew no other way).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10467">D3FiANC3</a> — Sun Feb 01, 2009 2:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-02-01T14:04:16-04:00</updated>

		<published>2009-02-01T14:04:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87194#p87194</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87194#p87194"/>
		<title type="html"><![CDATA[Where have I gone wrong? (pubm)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87194#p87194"><![CDATA[
For some very odd reason, I tend to not keep track of the warez-scene :p<br>In any case, not having a -command (which I assume you were thinking of with -callback) argument means it is running in synchronous mode. That is, the ::http::geturl command will block until the whole webpage is loaded, or an error/abort condition occurs. The content of the retrieved data is then directly returned, rather than returning a http transaction token.<br><br>Whenever using the http package with eggdrops, use asynchronous mode, regardless of the script's use.<br>(No, I did not correct this in my earlier post, I was a lazy boy)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sun Feb 01, 2009 2:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-02-01T13:42:46-04:00</updated>

		<published>2009-02-01T13:42:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87193#p87193</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87193#p87193"/>
		<title type="html"><![CDATA[Where have I gone wrong? (pubm)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87193#p87193"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>  set url "http://www.myurl.com/gotime.php?[::http::formatQuery prerls $text]"  set agent "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"  set page [::http::config -useragent $agent]  set page [::http::geturl $url]  set preinfo [::http::data $page]</code></pre></div></div></blockquote>Wasn't aware that bindings were case insensitive, always assumed it was WYSIWYG.. thanks for clarifying that bit..<br><br>But, do you notice the lack of -timeout or -callback within the http::geturl. This is how most warez pre scripts operate. They do not need any html, they just need to send the query to the php engine which will append the release to the database.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Feb 01, 2009 1:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-02-01T13:26:02-04:00</updated>

		<published>2009-02-01T13:26:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87192#p87192</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87192#p87192"/>
		<title type="html"><![CDATA[Where have I gone wrong? (pubm)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87192#p87192"><![CDATA[
@speechles, masks of bindings do not care for case.<br>However, the manual check of the nickname is indeed case sensitive.<br><br>As for sanitizing the url for http:get, just use the ::http::formatQuery.<br><div class="codebox"><p>Code: </p><pre><code>package require httpbind pubm - "#mychan *released*ago*" blowmeproc blowme {nick host handle channel text} {#drop all those hidious regsub's, just do as arfer suggested and scrub off colors/controlcodes# regsub -all {([\002\017\026\037]|[\003]{1}[0-9]{0,2}[\,]{0,1}[0-9]{0,2})} $text "" text# regsub -all " " $text "+" text# regsub -all "(" $text "%28" text# regsub -all ")" $text "%29" text set text [stripcodes $text bcruag]#Lets do a proper test of the nickname, and throw in -nocase as illustrated by speechles. if {[string equal -nocase $nick "MrBot"} {#Use the http-library to build your url, works alot better...  set url "http://www.myurl.com/gotime.php?[::http::formatQuery prerls $text]"  set agent "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"  set page [::http::config -useragent $agent]  set page [::http::geturl $url]  set preinfo [::http::data $page]#I'm not quite sure what you intended here.. Care to try and explain?  upvar #0 $page state  set max 0#Now, preinfo contains the webpage, but what to do now? Print it somewhere? }} </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sun Feb 01, 2009 1:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-02-01T12:43:17-04:00</updated>

		<published>2009-02-01T12:43:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87191#p87191</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87191#p87191"/>
		<title type="html"><![CDATA[Where have I gone wrong? (pubm)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87191#p87191"><![CDATA[
LOL!! OK, don't rub that one in. I never even saw that coming<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sun Feb 01, 2009 12:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-02-01T11:54:54-04:00</updated>

		<published>2009-02-01T11:54:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87190#p87190</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87190#p87190"/>
		<title type="html"><![CDATA[Where have I gone wrong? (pubm)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87190#p87190"><![CDATA[
Your problem is likely case. You've bound to lowercase words and if any uppercase letters happen to be part of that it will not trigger. Try using something similar to how I've done it below. Let the procedure do the figuring with a series of string equal/matches. I've also correctly added the formatQuery for your text instead of your regsubbing () into html values. User agent shouldnt matter at all as this is your site, you can omit it if you want. <br><div class="codebox"><p>Code: </p><pre><code>package require httpbind pubm - "*" blowmeproc blowme {nick host handle channel text} {  if {[string equal -nocase "mrbot" $nick] &amp;&amp; \    [string equal -nocase "#mychan" $chan] &amp;&amp; \    [string match -nocase "*released*ago*" $text]} {    set url "http://www.myurl.com/gotime.php"    set agent "Mozilla"    set page [http::config -useragent $agent]    set page [http::geturl $url -query [http::formatQuery prerls [stripcode brcuag $text]]]    # if your using the above query to build a php database, you can remove the rest    # below this, you don't need the page html or upvar...    # dunno what max is.. might need that    set preinfo [http::data $page]    upvar #0 $page state    set max 0  }}</code></pre></div>Keep in mind, the entire contents of $text will be sent to your php. This is likely not what you want or perhaps is what you want. If it isn't what you want you will need to perform a regexp to extract the data you do want passed to your php.<br><blockquote class="uncited"><div>I deduced from this that the URL would be :-<br><br><a href="http://www.myurl.com/gotime.php?prerls=%28BETA%29+Beta.v0.27+was+released+20h+3m+22s+ago" class="postlink">http://www.myurl.com/gotime.php?prerls= ... 3m+22s+ago</a><br><br>I pasted that into a browser and got nothing useful that might tell me what you are trying to do.</div></blockquote>Heh, myurl is likely a placeholder because that php places entries into a database. If poster had provided the correct url to add entries to his database this wouldn't exactly be the smartest thing to do. Since no useful data comes of this is why I advise the poster to drop the http::data statement and the upvar right after that, it's not needed.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Feb 01, 2009 11:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-02-01T11:27:57-04:00</updated>

		<published>2009-02-01T11:27:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87189#p87189</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87189#p87189"/>
		<title type="html"><![CDATA[Where have I gone wrong? (pubm)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87189#p87189"><![CDATA[
I think if you explain what you are trying to do, it might help us to assist.<br><br>From what I can gather, if MrBot (not clear whether that is the botnick on which this script is loaded) says in #mychan something that matches *released*ago* then you attempt to strip text codes with a regsub (I can't see that working) then replace ) ( and " " with %29, %28 and + respectively to form a valid URL from the text. Then append the resultant text to <a href="http://www.myurl.com/gotime.php?prerls=" class="postlink">http://www.myurl.com/gotime.php?prerls=</a><br><br>First off, use the Eggdrop Tcl command stripcodes to strip text formatting codes as follows :-<br><br>set text [stripcodes bcruag $text]<br><br>The channel text which you want the script to respond to is typically :-<br><br>&lt;MrBot&gt; (BETA) Beta.v0.27 was released 20h 3m 22s ago<br><br>I deduced from this that the URL would be :-<br><br><a href="http://www.myurl.com/gotime.php?prerls=%28BETA%29+Beta.v0.27+was+released+20h+3m+22s+ago" class="postlink">http://www.myurl.com/gotime.php?prerls= ... 3m+22s+ago</a><br><br>I pasted that into a browser and got nothing useful that might tell me what you are trying to do.<br><br>Quite aside from the success or otherwise of the coding inside the PUBM proc, if you wish to test if 'things' are happening you could temporarily add output statements at appropriate points. For example, if you want to see if the bind is triggering simply add this as the first line of code inside the proc (and watch the partyline for output) :-<br><br>putlog "bind triggered"<br><br>You can use this technique to find where your code fails, if there is not otherwise any Tcl error to be seen in the partyline.<br><br>A typical http useragent (from an MS Windows machine) would be :-<br><br>"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sun Feb 01, 2009 11:27 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[D3FiANC3]]></name></author>
		<updated>2009-02-01T08:37:48-04:00</updated>

		<published>2009-02-01T08:37:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87187#p87187</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87187#p87187"/>
		<title type="html"><![CDATA[Where have I gone wrong? (pubm)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87187#p87187"><![CDATA[
Putting aside the fact that I am a huge Tcl nooblet, where have I gone wrong here?  It never binds.   <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"> <br><div class="codebox"><p>Code: </p><pre><code>package require httpbind pubm - "#mychan *released*ago*" blowmeproc blowme {nick host handle channel text} { regsub -all {([\002\017\026\037]|[\003]{1}[0-9]{0,2}[\,]{0,1}[0-9]{0,2})} $text "" text regsub -all " " $text "+" text regsub -all "(" $text "%28" text regsub -all ")" $text "%29" textif {$nick == "MrBot"} {   set url "http://www.myurl.com/gotime.php"  set agent "Mozilla"  set query "$url?prerls=$text"  set page [http::config -useragent $agent]  set page [http::geturl $query]  set preinfo [http::data $page]  upvar #0 $page state  set max 0 }}</code></pre></div>&lt;MrBot&gt; (BETA) Beta.v0.27 was released 20h 3m 22s ago<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10467">D3FiANC3</a> — Sun Feb 01, 2009 8:37 am</p><hr />
]]></content>
	</entry>
	</feed>
