Linux Today: Linux News On Internet Time.

More on LinuxToday

Linux Magazine: Perl of Wisdom: Moving Your News Service

Aug 30, 2000, 00:45 (0 Talkback[s])
(Other stories by Randal L. Schwartz)


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

[ Thanks to Robert McMillan for this link. ]

"Several months ago in this space, I talked about how my ISP was looking at the performance of their news server. I wrote a program to see just how bad the news service was compared to the other local ISPs, using Deja as a baseline. Well, the ISP just got bought out by a big national chain. They decided not to fight the spotty news service any more and just convert over to the conglomerate's big service. The problem with moving from one news server to another is that the article numbers are not in sync, so a .newsrc file will have the right newsgroups but the wrong "read" marks. And since I read a lot of newsgroups, I don't have time to reread existing articles, and I don't want to just throw away any new articles."

"The solution is a bit complicated and requires extensive bookkeeping, but that's what computers are for, and Perl in particular. What you need to do is mark as read any articles you've already seen. Messages are uniquely identified by a message ID, and you can get that mapped into article numbers via the appropriate XHDR request to the NNTP server."

"So, basically, for every subscribed newsgroup, we fetch the message IDs of the last 500 articles from the new server (500 being the maximum number of unread articles per group I'd care to face). Then, we fetch the last 1,500 or so message IDs from the old server. Then, for every message ID on the new server, if I've already read it on the old server, mark it as read in the new newsrc."

Complete Story

Related Stories: