I understand users have more direct access to the Internet via Linux than
from Windows (if you can figure out how) so you can even create your own usenet newsgroup by entering a simple command and the various server owners get messages (and can block it if they choose) without the net entry side pre-blocking activities of server owners that are paid for with ISP fees or require logging in like Google. Is there any way to gain that direct access via Dolphin? Thanks. |
True Christian wrote:
>I understand users have more direct access to the Internet via Linux than >from Windows (if you can figure out how) so you can even create your own >usenet newsgroup by entering a simple command and the various server owners > > Writing usenet posts isn't that hard really, its very much like SMTP in how it works. I'll dig out the RFC and write up a simple class to post a message for you if you like... |
Mark Derricutt wrote:
> Writing usenet posts isn't that hard really, its very much like SMTP > in how it works. I'll dig out the RFC and write up a simple class to > post a message for you if you like... Right - I'm new to Smalltalk so this code could probably be improved upon imensely, but it works... It even handles authentication... Mark "Filed out from Dolphin Smalltalk XP"! TestCase subclass: #NNTPTestCase instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' classInstanceVariableNames: ''! NNTPTestCase guid: (GUID fromString: '{3C32CBAA-A199-449D-8419-DF1766407FE6}')! NNTPTestCase comment: ''! !NNTPTestCase categoriesForClass!Unclassified! ! !NNTPTestCase methodsFor! testConnect | nntp | nntp := NNTPClient new. self assert: (nntp connect: 'library.airnews.net' port: 119)! testPost | nntp | nntp := NNTPClient new. nntp authenticate: 'talios' with: '****'. (nntp connect: 'library.airnews.net' port: 119) ifTrue: [self assert: (nntp postTo: 'alt.test' from: '[hidden email]' subject: 'Test' body: 'Test Post')]! ! !NNTPTestCase categoriesFor: #testConnect!public! ! !NNTPTestCase categoriesFor: #testPost!public! ! "Filed out from Dolphin Smalltalk XP"! Object subclass: #NNTPClient instanceVariableNames: 'host port socket user password' classVariableNames: '' poolDictionaries: '' classInstanceVariableNames: ''! NNTPClient guid: (GUID fromString: '{C5367367-B1BA-4747-981E-890C2062DCDB}')! NNTPClient comment: 'Simple NNTP Client based on the example code show at: http://www.freesoft.org/CIE/RFC/977/33.htm and http://www.faqs.org/rfcs/rfc2980.html Even authentication works ;) '! !NNTPClient categoriesForClass!Unclassified! ! !NNTPClient methodsFor! authenticate: aUser with: aPassword "Set Authenticatation credentials..." user := aUser. password := aPassword. ! connect: aHostName port: aPortNumber "Connect to a server" | input | host := aHostName. port := aPortNumber. socket := Socket port: port address: (InternetAddress host: host). socket connect. input := socket readStream readPage collection asString. ^'200*' match: input! postTo: aGroupName from: aSender subject: aSubject body: aBody "Send the message..." | input | (socket writeStream) nextPutAll: 'POST' , String lineDelimiter; flush. input := socket readStream readPage collection asString. ('480*' match: input) ifTrue: [self sendAuthenticationCredentials]. "('340*' match: input) ifFalse: [^false]." (socket writeStream) nextPutAll: 'Newsgroups: ' , aGroupName , String lineDelimiter; nextPutAll: 'From: ' , aSender , String lineDelimiter; nextPutAll: 'Subject: ' , aSubject , String lineDelimiter; nextPutAll: String lineDelimiter; nextPutAll: aBody , String lineDelimiter; nextPutAll: '.' , String lineDelimiter; flush. ^'240*' match: socket readStream readPage collection asString. Transcript show: 'NNTP post to ' , aGroupName , ' by ' , aSender , ' sent successfully.'! sendAuthenticationCredentials "Send the authentication credentials." | input | (socket writeStream) nextPutAll: 'AUTHINFO user ' , user , String lineDelimiter; flush. ('381*' match: socket readStream readPage collection asString) ifTrue: [(socket writeStream) nextPutAll: 'AUTHINFO pass ' , password , String lineDelimiter; flush. input := socket readStream readPage collection asString. ('281*' match: input) ifFalse: [^false]] ifFalse: [^false]! ! !NNTPClient categoriesFor: #authenticate:with:!public! ! !NNTPClient categoriesFor: #connect:port:!public! ! !NNTPClient categoriesFor: #postTo:from:subject:body:!public! ! !NNTPClient categoriesFor: #sendAuthenticationCredentials!public! ! |
Mark Derricutt wrote:
> It even handles authentication... Also mentioned this on my blog at: http://www.talios.com/read/805606.htm Mark |
Free forum by Nabble | Edit this page |