Re: [bme-develop] Major update + some errors
Status: Planning
Brought to you by:
sirmik
From: D. G. <A00...@it...> - 2004-09-18 21:02:07
|
Hello guys, > I'm doing a major update of the contact related code. We now have a > Contact > class that represents contacts of course... a User class that > represents the > user(and reimplements some of the contact methods to deliver user > specific > behaviour, like for the userpic functions)...I also made a Status > class to > represent msnstatusses(stati?)...and a ContactItem class that draws > the > contacts in the ContactListView. I've almost got this code > working...but > there seems to be smth wrong with the Status archiving code...maybe > some of > you can help, this is the BArchivable related code: > > Status::Status(BMessage* archive) > { > archive->FindString("Status::statusName",&statusName); > archive->FindString("Status::statusAbbreviation",& > statusAbbreviation); > > BMessage msg; > if (archive->FindMessage("Status::statusIcon",&msg) == B_OK) > { > BArchivable* obj = instantiate_object(&msg); > statusIcon = dynamic_cast<BBitmap*>(obj); My suggestion is to use this code instead. I am not sure is this is the problem or not but, you might want to try it out: statusIcon = cast_as(BBitmap::Instantiate(&msg),BBitmap); > } > } > > BArchivable* Status::Instantiate(BMessage *archive) Shouldn't this be Status* Status::Instantiate(BMessage *archive) > { > if (validate_instantiation(archive, "Status")) > return new Status(archive); > return NULL; > } > > status_t Status::Archive(BMessage *archive, bool deep) const > { > archive->AddString("class","Status"); > archive->AddString("Status::statusName",statusName); > archive-> > AddString("Status::statusAbbreviation",statusAbbreviation); > if(deep) > { > BMessage child; > statusIcon->Archive(&child); > archive->AddMessage("Status::statusIcon",&child); > } > return B_OK; > } > > the program crashes on startup...it seems there's something going > wrong in > the validate_instantiation method...it crashes saying that there was > a > segment fault in strcmp in that function...any idea what I'm doing > wrong? I am not sure, but it might had to do with the BMessage that you are passing to Status::Instantiate, how are you creating the objects? > > Btw Daniel do we need to have the MsnObject in the Contact class(like > we had > it in the MsnBuddy code)? What does this MsnObject code do anyway? Right now it has no use. We will need it to create msn Objects tags once we introduce user display pictures and custom emoticons. So far Bme only stores msnObjects from the contacts in your list, it doesn't create one for the user. To update you on getting display pics, Bme now is able to send invitations to request your conversation buddy's display picture, so far the only response I get is 500 Internal Error, this means there is something wrong in the invitation, I believe the problems is in the msn Object encoding but I haven't been able to figure it out. > Oh and I'm also talking with Remi of BeosFrance to help us with > designing > some emoticons...he sent me some already, and they look very > promising. Nice! I hope they look good. > > regards, > > Tim > Regards, Daniel |