Ralf Schlatterbeck wrote:
> Hello Vadim, hello list,
> I'm trying to implement SMS to a contact as a SIP-Message. We have a
> gateway that uses SIP Chat to send SMS. The gateway also supports
> replies to SMS to the SIP-Account (or will support this in the near
> future).
>
> So my idea is to automagically create a SIP contact
> [EMAIL PROTECTED]
> which is updated whenever the mobile phone number of a contact changes.
> I'd guard this with an advanced config variable.
> This would enable SMS via SIP (for all accounts, not just Wengo-Type
> accounts) and would open a Chat dialog (not just the one-way sms widget
> that is used by the wengo sms service).
>
> I came up with the following code in model/contactlist/Contact.cpp
> (called by ContactProfile::updatePresenceState in the base class,
> unfortunately not all instances of ContactProfile are of type Contact):
>
> void Contact::updateSmsContact()
> {
> Config & config = ConfigManager::getInstance().getCurrentConfig();
> LOG_ERROR("Contact::updateSmsContact: " + _mobilePhone);
> if(config.getSmsFeatureUseSip())
> {
> SipAccount * sipAccount = _userProfile.getSipAccount();
> String contactId = _mobilePhone + "@" + sipAccount->getRealm();
> if (_smsContact) {
> if (contactId == _smsContact->getContactId())
> return;
> removeIMContact (* _smsContact);
> delete _smsContact;
> }
> _smsContact = new IMContact (sipAccount->getProtocol(), contactId);
> addIMContact (* _smsContact);
> }
> }
>
> Unfortunately I have to put this into the Contact class but at least the
> Qt interface uses the base class of Contact, ContactProfile. Is there a
> technical reason for this? The (ugly) alternative is to move this method
> to ContactProfile, give it a parameter userProfile, and modify every
> client to call the method after modifying the mobile number in
> ContactProfile.
>
> There are other areas that would profit if all clients use a Contact
> instead of a ContactProfile -- see my previous patch "fix duplicate
> qutecom-realm when editing qutecom contact" where there is duplicate
> code for computing the Wengo- or SIP Realms that should really be moved
> inside the Contact class:
> http://thread.gmane.org/gmane.comp.voip.qutecom.devel/65
>
> Would it be possible to change the Qt Interface to use Contact instead
> of ContactProfile or will I run into a wall later when attempting this?
> I think the Qt interface *does* have access to the userProfile which is
> the crucial difference between the two classes.
>
> The when only one of the classes is used throughout we could get rid of
> one of them...
>
> Ralf
>
This question thrilled me too.
I think the best person to answer it would be tanguy....
Thanks
Vadim
_______________________________________________
QuteCom-dev mailing list
[email protected]
http://lists.qutecom.org/mailman/listinfo/qutecom-dev