stcn52 / flowlib

Automatically exported from code.google.com/p/flowlib
0 stars 0 forks source link

Can't download filelists from russian nicks #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1) change ActiveDownloadFilelistFromUser.cs like this:

                case Actions.UserOnline:
                    UserInfo usrInfo = e.Data as UserInfo;
                    if (usrInfo == null) return;
                    users.Enqueue(usrInfo.ID);
                    bool hasMe = (hub.GetUserById(hub.Me.ID) != null);
                    if (hasMe && users.Count > 0)
                        Console.Write(users.Count + " users");
                    while (hasMe && users.Count > 0)
                    {
                        string usrId = users.Dequeue();
                        User usr = null;
                        if ((usr = hub.GetUserById(usrId)) != null)
                        {
                            ContentInfo info = new ContentInfo
(ContentInfo.FILELIST, BaseFilelist.XMLBZ);
                            info.Set(ContentInfo.STORAGEPATH, currentDir + 
@"Filelists\" + usr.ID + ".dcxml.bz2");
                            DownloadItem dwnItem = new DownloadItem(info);
                            downloadManager.AddDownload(dwnItem, new Source
(hub.RemoteAddress.ToString(), usr.ID));
                            UpdateBase(this, new FmdcEventArgs
(Actions.StartTransfer, usr)); // Start transfer to user
                            for (int i = 0; i < 300; i++)
                                if (downloadManager.ContainsDownload
(dwnItem))
                                    System.Threading.Thread.Sleep(100);
                            downloadManager.RemoveDownload(dwnItem);  // 
to avoid other bug during saving many filelists at one time
                        }
                    }
                    break;

2) also add next line in the beginning of this class
        public Queue<string> users = new Queue<string>();

- this code successfully downloads all filelists from english nicks, but 
never downloads filelists from russian nicks even on russian system locale.
Why? - I don't know.
What happens? - simply exiting from the cycle by timeout (30 seconds) - 
only for russian nicks (without any program exeptions).
What is the expected output? - downloading all filelists, even from 
russian nicks.
What do you see instead? - downloading filelists only from english nicks.
What version of the product are you using? - FlowLib 20080628.
On what operating system? - Windows XP Eng + Russian MUI + Russian system 
locale.
Call Stack? - there are no any exceptions.
Other info - using DC++ hub PtokaX 0.3.6.0

Original issue reported on code.google.com by arctic....@gmail.com on 10 Aug 2008 at 2:16

GoogleCodeExporter commented 9 years ago
ok.
so this line is true for the russian nicks?
{{{
if ((usr = hub.GetUserById(usrId)) != null)
}}}

do you have a hub i can test this in?

Original comment by blomman84 on 10 Aug 2008 at 8:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
>so this line is true for the russian nicks?
>if ((usr = hub.GetUserById(usrId)) != null)
Yes, it is.
"russian nicks" = hub users with cyrillic symbols like "абвгд" in their 
nicks.

>do you have a hub i can test this in?
No, my hub is inaccessible from the Internet.
But you can find other russian PtokaX hubs here:
http://www.dchublist.com/?page=result&type=as&country=Russian+Federation

Original comment by arctic....@gmail.com on 11 Aug 2008 at 7:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have located source of problem and i have a quick fix that you can implement 
in
your code if you can't wait until i have fixed problem in FlowLib.

=Description of problem=
Problem lays in the auto handling of what protocol to use. This is done so you 
as a
developer shouldn't need to be bothered if the hub you are connecting to is 
using Adc
or Nmdc protocol. Problem is that when switching between protocols we are also
switching between string encodings. It is here the problem lays. It doesn't 
convert
the byte codes correctly as it is now.

=Temporary workaround=
You can temporary solve this if it is ok that your bot/client can only connect 
to
hubs that use Nmdc protocol (Main hubs on direct connect use Nmdc protocol and 
PtokaX
don't know any other protocol)

What you should do is changing from:
trans.Protocol = new FlowLib.Protocols.AdcProtocol(trans);
to:
trans.Protocol = new FlowLib.Protocols.TransferNmdcProtocol(trans);

in the ActiveDownloadFilelistFromUser example.

Original comment by blomman84 on 16 Aug 2008 at 8:16

GoogleCodeExporter commented 9 years ago
This issue should now be fixed in latest SVN version.
Can you confirm this?

Original comment by blomman84 on 16 Aug 2008 at 8:57

GoogleCodeExporter commented 9 years ago
>What you should do is changing from:
>trans.Protocol = new FlowLib.Protocols.AdcProtocol(trans);
>to:
>trans.Protocol = new FlowLib.Protocols.TransferNmdcProtocol(trans);

OK, it works for russian nicks as expected.
Thanks for temporary solution.

> This issue should now be fixed in latest SVN version.
> Can you confirm this?
Sorry, I can't find the latest SVN version.
Could you send it to me, please?

Original comment by arctic....@gmail.com on 18 Aug 2008 at 4:18

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
no. but you can find it here: http://code.google.com/p/flowlib/source/checkout

download a good svn (subversion) tool to use :)

Original comment by blomman84 on 20 Aug 2008 at 10:18