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

Richard Dale rdale at foton.es
Tue Nov 6 22:37:19 UTC 2007


On Tuesday 06 November 2007 21:57:56 Chris Gow wrote:
> 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]
This works fine for me as long as I don't include 
the 'dcopref.setDCOPClient(dc)' line:

mardigras rdale 530% irb -rkorundum
irb(main):001:0> dc = KDE::DCOPClient.new
=> #<KDE::DCOPClient:0xb4efe728 name="unnamed">
irb(main):002:0> dc.registerAs("wtf", false)
=> "wtf"
irb(main):003:0> dcopref = KDE::DCOPRef.new("kopete", "KopeteIface")
=> #<KDE::DCOPRef:0xb4ef815c app="kopete", obj="KopeteIface">
irb(main):004:0> dcopref.setAway("I am still not away", false)
=> true
irb(main):005:0> dcopref.setAway("I am still not away", false)
=> true

The message appears in kopete, my icons were changed and I am marked as being 
away.

> 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 :(
I tried this and got a kmail composer window appearing:

mardigras rdale 531% irb -rkorundum
irb(main):001:0> about = KDE::AboutData.new("test", "test", "0.1")
=> #<KDE::AboutData:0xb4f27e84 appName="test", copyrightStatement=nil, 
programName="test", version="0.1", shortDescription=nil, homepage=nil, 
bugAddress="submit at bugs.kde.org">
irb(main):002:0>  KDE::CmdLineArgs.init(ARGV, about)
=> nil
irb(main):003:0> kapp = KDE::Application.new
=> #<KDE::Application:0xb4f217c8 name="test">
irb(main):004:0> dcopref = KDE::DCOPRef.new("kmail", "KMailIface")
=> #<KDE::DCOPRef:0xb4f1dba0 app="kmail", obj="KMailIface">
irb(main):005:0> dcopref.openComposer("to", "cc", "bcc", "subj", "body",
irb(main):006:1* false)
=> #<KDE::DCOPRef:0xb4f159b4 app="kontact", obj="0x9912e98">
irb(main):007:0>

I can't remember ever fixing a bug for boolean arguments in korundum, and so 
I'm not sure why your version is crashing.

-- Richard



More information about the Kde-bindings mailing list