<div>Hi,</div><div><br></div><div>I want to send IM(Instant Message) from GTalk of N900 using PyQt. I have found sending sms PyQt script here <a href="http://wiki.maemo.org/Phone_control#Send_SMS">http://wiki.maemo.org/Phone_control#Send_SMS</a>. and tried to modify for Instant Messaging. But I am getting "send failed" error. I am new to PyQt. </div>
<div><br></div><div>I have logged in to gtalk before running the script & then started the script.</div><div>the following is the code I have modified.</div><div><br></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51); ">app = QCoreApplication(sys.argv)</span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"><br></span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">'<i>''get number and name'''</i></span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">stringit = sys.argv</span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">numpertemp = str(stringit[1:2])</span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">mesits = str(stringit[2:])[2:-2]</span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"><br></span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">num = str(numpertemp[2:-2])</span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"><br></span></div><div>
<span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">if (mesits == ""):</span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"> print "Usage:"</span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"> print "python ssms.py 01234567 'message text here'"</span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"> sys.exit(69)</span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">else:</span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"> print "number is " + str(num)</span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"> print "message is " + str(mesits)</span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"><br>
</span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">'<i>''define message to be sent'''</i></span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">numperi = QtCore.QString(num)</span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"><br></span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">numper = QMessageAddress(QMessageAddress.InstantMessage, "<a href="mailto:user@gmail.com">user@gmail.com</a>")</span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">mesitsi = QMessage()</span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">mesitsi.setType(QMessage.InstantMessage)</span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">mesitsi.setTo(numper)</span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">mesitsi.setBody(mesits)</span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"><br></span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">'<i>''send message'''</i></span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">sender = QMessageService()</span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">if (sender.send(mesitsi)):</span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"> print "success"</span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 51);">else:</span></div><div>
<span class="Apple-style-span" style="background-color: rgb(255, 255, 51);"> print "fail"</span></div><div><br></div><div>where as modifying "writemessage" example of QtMobility(C++) I am able to send IM by making the above changes only. but not with PyQt. I need with PyQt. any help would be greatly appreciated</div>
<div><br></div><div><br></div><div>-Praveen.</div><div><br></div>