Posted: Sun Jan 08, 2006 4:00 am Post subject: Buddy Icon, Connection Timing out
ok...two questions.....
Code:
print "Setting Buddy Icon...";
# open the buddy icon
open (ICON, "./DATA/RESOURCE/buddy.gif");
binmode ICON;
my @data = <ICON>;
close (ICON);
#test writing the icon other places
open (OUTF, ">testicon.gif");
binmode OUTF;
print OUTF @data;
close (OUTF);
$ok...it works, but why isnt it setting the icon?
$aim->set_icon(join("",@data));
print "Done\n";
$aim->commit_buddylist();
# Buddy Icon doesnt work. Ill worry about that l8tr. :) #
I tryed using that code for the buddy icon. However the "buddy_icon_uploaded" callback never seems to get called. It seems to load all the data in fine and write it to a different file just fine, but when uploaded the callback is never called. The file is under 4 kb, and I have tried gif's, bmp's, and jpg's. all the same result.
---------------------------------
Code:
while (1)
{
if ($timeout >= 10000)
{
$time = localtime(time);
$aim->commit_buddylist(); #keep it from timeing out I hope.
system_log(0,"Ping!\n");
$timeout = 0;
}
$timeout++;
$aim->do_one_loop(); #Wait for stuff...forever and ever and ever
}
My other question is, inorder to keep my bot from timing out, I added "$aim->commit_buddylist();" every 10000 times around (or ~1 minute). It seems to work, but is that a good way to keep it from timing out, or is there something else I should do?
I don't get why your bot should time out to begin with. I leave my bots running for days in a row and don't have to add any code to make them not time out, all they're doing is do_one_loop.
Your buddy icon code looks good. AIM apparently never was the best with buddy icon support. My bot's buddy icon uploading code is fine too but it only works some of the time, but more often than not its icon isn't uploaded or for some reason isn't visible to its users.
So just don't put a lot of priority on the buddy icon, it should just be a minor little feature to accent the bot. So don't have the bot be like "type the word that appears in my buddy icon to continue" because more likely than not the user won't see its buddy icon. _________________ Current Site (2008) http://www.cuvou.com/
Cer is on the money, many times you will not see your uploaded icon right away. I've had it where it took a while before it appeared, and the uploaded handler is never called. Not a huge priority. Also, writing the icon to a diff place isn't going to solve anything. No idea why you think your bot will time out, as Cer said the do_one_loop is all you need.
You can try adding an else to the icon_set method to see if it's having a problem at that point, but this feature has always been iffy at best with Net Oscar. _________________ Check out Botworld! A dev resource for things bot.
Downloads, articles, news, fourm and more.
http://botworld.marzopolis.com
OK...I fixed the problem with timing out and now removed the commit buddy list thing from it. The problem was else where.
As for the buddy icon, I will resume work on other things and just leave that alone for a while. The reason I had it writing the icon to someplace else was to see if I opened the file correctly, which I did.