src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
/**
     * Sends the text contained in the write area as an SMS message.
     */
Sends the text contained in the write area as an SMS message.
Sends the text contained in the write area as an SMS message .
public void sendSmsMessage()
    {
        String messageText = getTextFromWriteArea(
            OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE);
        ChatTransport smsChatTransport = chatSession.getCurrentChatTransport();
        if (!smsChatTransport.allowsSmsMessage())
        {
            Iterator<ChatTransport> chatTransports
                = chatSession.getChatTransports();
            while(chatTransports.hasNext())
            {
                ChatTransport transport = chatTransports.next();
                if (transport.allowsSmsMessage())
                {
                    smsChatTransport = transport;
                    break;
                }
            }
        }
        if (!smsChatTransport.allowsSmsMessage())
        {
            logger.error("Failed to send SMS.");
            this.refreshWriteArea();
            this.addMessage(
                smsChatTransport.getName(),
                new Date(),
                Chat.OUTGOING_MESSAGE,
                messageText,
                "plain/text");
            this.addErrorMessage(
                smsChatTransport.getName(),
                GuiActivator.getResources().getI18NString(
                    "service.gui.SEND_SMS_NOT_SUPPORTED"));
            return;
        }
        SendSmsDialog smsDialog
            = new SendSmsDialog(this, smsChatTransport, messageText);
        if(smsChatTransport.askForSMSNumber())
        {
            Object desc =
                smsChatTransport.getParentChatSession().getDescriptor();
            if(desc instanceof MetaContact)
            {
                UIPhoneUtil contactPhoneUtil =
                    UIPhoneUtil.getPhoneUtil((MetaContact) desc);
                List<UIContactDetail> uiContactDetailList;
                boolean useAllNumbers =
                    GuiActivator.getConfigurationService().getBoolean(
                        USE_ADDITIONAL_NUMBERS_PROP, false);
                if(useAllNumbers)
                    uiContactDetailList
                        = contactPhoneUtil.getAdditionalNumbers();
                else
                    uiContactDetailList
                        = contactPhoneUtil.getAdditionalMobileNumbers();
                if(uiContactDetailList.size() != 0)
                {
                    SMSManager.sendSMS(
                        this, uiContactDetailList, messageText, this);
                    return;
                }
            }
            smsDialog.setPreferredSize(new Dimension(400, 200));
            smsDialog.setVisible(true);
        }
        else
        {
            smsDialog.sendSmsMessage(null, messageText);
            smsDialog.dispose();
        }
    }
public void sendSmsMessage ( ) { String messageText = getTextFromWriteArea ( OperationSetBasicInstantMessaging . DEFAULT_MIME_TYPE ) ; ChatTransport smsChatTransport = chatSession . getCurrentChatTransport ( ) ; if ( ! smsChatTransport . allowsSmsMessage ( ) ) { Iterator < ChatTransport > chatTransports = chatSession . getChatTransports ( ) ; while ( chatTransports . hasNext ( ) ) { ChatTransport transport = chatTransports . next ( ) ; if ( transport . allowsSmsMessage ( ) ) { smsChatTransport = transport ; break ; } } } if ( ! smsChatTransport . allowsSmsMessage ( ) ) { logger . error ( "Failed to send SMS." ) ; this . refreshWriteArea ( ) ; this . addMessage ( smsChatTransport . getName ( ) , new Date ( ) , Chat . OUTGOING_MESSAGE , messageText , "plain/text" ) ; this . addErrorMessage ( smsChatTransport . getName ( ) , GuiActivator . getResources ( ) . getI18NString ( "service.gui.SEND_SMS_NOT_SUPPORTED" ) ) ; return ; } SendSmsDialog smsDialog = new SendSmsDialog ( this , smsChatTransport , messageText ) ; if ( smsChatTransport . askForSMSNumber ( ) ) { Object desc = smsChatTransport . getParentChatSession ( ) . getDescriptor ( ) ; if ( desc instanceof MetaContact ) { UIPhoneUtil contactPhoneUtil = UIPhoneUtil . getPhoneUtil ( ( MetaContact ) desc ) ; List < UIContactDetail > uiContactDetailList ; boolean useAllNumbers = GuiActivator . getConfigurationService ( ) . getBoolean ( USE_ADDITIONAL_NUMBERS_PROP , false ) ; if ( useAllNumbers ) uiContactDetailList = contactPhoneUtil . getAdditionalNumbers ( ) ; else uiContactDetailList = contactPhoneUtil . getAdditionalMobileNumbers ( ) ; if ( uiContactDetailList . size ( ) != 0 ) { SMSManager . sendSMS ( this , uiContactDetailList , messageText , this ) ; return ; } } smsDialog . setPreferredSize ( new Dimension ( 400 , 200 ) ) ; smsDialog . setVisible ( true ) ; } else { smsDialog . sendSmsMessage ( null , messageText ) ; smsDialog . dispose ( ) ; } }
Sends the text contained in the write area as an SMS message.
Sends the text contained in the write area as an SMS message .
// If there's no operation set we show some "not supported" messages // and we return. // We open the send SMS dialog. // descriptor will be metacontact