[Kde-bindings] sending an email using korundum and dcop

Chris Gow sniffy at rogers.com
Tue Nov 6 21:57:56 UTC 2007


On Tuesday 06 November 2007 03:47:59 Richard Dale wrote:
> On Tuesday 06 November 2007 02:50:26 Chris Gow wrote:
> > On Monday 05 November 2007 17:34:23 Caleb Tennis wrote:
> > > > So, how do I get korundum to call the correct dcop function?
> > >
> > > Here's a snippet of what I did in an old app.  It might help.
> > >
> > >
> > > @dcopclient = KDE::DCOPClient.new
> > > @dcopclient.attach
> > > @dcopclient.registerAs("fuel_state")
> > >
> > >
> > > @dcop = KDE::DCOPRef.new("gina","MessageHandlerBase")
> > > @dcop.setDCOPClient(@dcopclient)
> > >
> > >
> > > @dcop.call("TriggerESTOPTimer(QString,unsigned int)","cuty_writer",
> > > secs)
> >
> > Thanks. It helps, but doesn't seem to solve my problem. If I try to call
> > a dcop function that takes only a string or no arguments, it works. If
> > the function takes a boolean or any other non string argument. I get
> > errors. I tried various functions kontact, kmail, klipper, kopete and
> > konqueror.
>
> For the original sendMessage call you need to pass empty strings rather
> than nils for the cc and bcc arguments. I've just tried this and it worked
> fine:
>
> res = dcopref.sendMessage("rdale at foton.es", "richard.j.dale at gmail.com",
> "", "", "test dcop message", "body of message",[])
Hmm..doesn't work here. Is it possible to make this call using the dcop shell 
command? (I'm not sure how to pass an empty list). Most likely this means 
I've messed something up in my environment.
>
> Boolean and other non-string arguments should certainly work, and I'm not
> sure what the problem is. Can you post the specific calls that don't work?
Sure. The one I tried in kopete is: setAway(QString, bool):

irb(main):001:0> require 'korundum'
=> true
irb(main):002:0> dc = KDE::DCOPClient.new
=> #<KDE::DCOPClient:0xb501e040 name="unnamed">
irb(main):003:0> dc.registerAs("wtf", false)
=> "wtf"
irb(main):004:0> dcopref = KDE::DCOPRef.new("kopete", "KopeteIface")
=> #<KDE::DCOPRef:0xb5017a74 app="kopete", obj="KopeteIface">
irb(main):005:0> dcopref.setDCOPClient(dc)
=> nil
irb(main):006:0> dcopref.call("setAway(QString, bool)", "I am still not away", 
false)
/usr/lib/ruby/1.8/KDE/korundum.rb:310: [BUG] Segmentation fault
ruby 1.8.6 (2007-06-07) [i486-linux]

The setAway(QString) worked for me. Attempting to call kmail 
openComposer(QString to,QString cc,QString bcc,QString subject,QString 
body,bool hidden) fails:

irb(main):001:0> require 'korundum'
=> true
irb(main):002:0> about = KDE::AboutData.new("test", "test", "0.1")
=> #<KDE::AboutData:0xb4fcc7e0 appName="test", copyrightStatement=nil, 
programName="test", version="0.1", shortDescription=nil, homepage=nil, 
bugAddress="submit at bugs.kde.org">
irb(main):003:0> KDE::CmdLineArgs.init(ARGV, about)
=> nil
irb(main):004:0> kapp = KDE::Application.new()
=> #<KDE::Application:0xb4fc5fe4 name="test">
irb(main):005:0> dcopref = KDE::DCOPRef.new("kmail", "KMailIface")
=> #<KDE::DCOPRef:0xb4fc23bc app="kmail", obj="KMailIface">
irb(main):006:0> dcopref.openComposer("to", "cc", "bcc", "subj", "body", 
false)
Segmentation fault (core dumped)

Any dcop call that takes only QStrings appear to work. I was able to call 
kmail checkAccount(QString) and checkMail

stumped :(

-- chris



More information about the Kde-bindings mailing list