I am having emense problems trying to connect to a hub witht he client I am working on. With NMDCH I get temp banned and in the stauts messages it puts $Key <whatever I sent>. Thanks NMDCH!
When I connect to PtokacX Hub I get the $Hello username back and it appears if I am logged in, and I can send chat messages just fine.. but the problem there is that I don't register as a logged in user in the hub software, but I do show up on everyone's list as a user (it sends out $Hello username and $MyInfo out correctly to all the connected clients). However, I am "hidden" on the hub.
I have sniffed packets between DC++ and the hubs and it appears I am doing everything the same, except I am not requesting $GetINFO for all the users, do I need to do this before it considers me logged in? I am not sure what is wrong here, I think it could be that my key is being miscalculated.
Here is the code I am using for the key:
Code: Select all
void generateKey(unsigned char *lock, unsigned char **fkey)
{
int count = 0, len = 0, offset = 0;
unsigned char *key = 0, *tkey= 0;
logit("About to do strlen");
len = strlen(lock);
logit("Allocating key");
erealloc((void **)&key, sizeof(char)*(len + 1) );
logit("About to while through key");
while(lock[++count])
key[count] = lock[count] ^ lock[count - 1];
logit("Setting first bytes of Key");
key[0] = lock[0] ^ lock[len - 1] ^ lock[len - 2] ^ 5;
count = 0;
logit("About to nibble swap keys");
while(key[count++])
key[count - 1] = ((key[count - 1] << 4)) | ((key[count - 1] >> 4));
count = 0;
logit("Mallocing temp key");
tkey = emalloc(sizeof(char)*(len + 1));
logit("Whiling through scanning and translating codes");
while(key[count++])
{
switch(key[count - 1])
{
case 0:
case 5:
case 36:
case 96:
case 124:
case 126:
erealloc((void **)&tkey, sizeof(char)*(len + offset + 11));
sprintf(&tkey[count - 1 + offset], "/%%DCN%.3d%%/", key[count - 1]);
offset += 10;
break;
default:
tkey[count - 1 + offset] = key[count - 1];
break;
}
}
tkey[len + offset] = 0;
*fkey = tkey;
}
I am not worried about optimizing that code at the moment, just that it is actually doing the right thing.
Any help would be appreciated.
Thanks,
~Moch