Korundum: error when overriding a KDE::RootPixmap method

  • Thread starter Martin Traverso
  • Start date
M

Martin Traverso

Hi,

I'm experimenting a bit with Korundum, but I'm having some problems. I have
the following code:

require 'Korundum'

app = Qt::Application.new([])
widget = Qt::Widget.new
pixmap = KDE::RootPixmap.new(widget)

class << pixmap
def updateBackground(x)
puts "update background"
end
end

pixmap.start

widget.show
app.setMainWidget(widget)
app.exec

When I run it I get this error:

ArgumentError: Cannot handle 'KSharedPixmap*' as argument of virtual method
KRootPixmap::updateBackground
from /usr/local/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:128:in
`method_missing'
from /usr/local/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:128:in `qt_invoke'
from /usr/local/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:128:in
`method_missing'
from /usr/local/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:128:in `exec'

If I remove the class << pixmap ... end section the program runs ok (but does
not do what I want, of course). Any idea of what the error means in this
context? What am I doing wrong?

Thanks for your help.

Martin
 
M

Mark Firestone

I want to build an internet email server into my Ruby BBS project. Does
anyone know of a good API to use?

Thanks,

Mark
 
R

Richard Dale

Martin said:
Hi,

I'm experimenting a bit with Korundum, but I'm having some problems. I
have the following code:

require 'Korundum'

app = Qt::Application.new([])
widget = Qt::Widget.new
pixmap = KDE::RootPixmap.new(widget)

class << pixmap
def updateBackground(x)
puts "update background"
end
end

pixmap.start

widget.show
app.setMainWidget(widget)
app.exec

When I run it I get this error:

ArgumentError: Cannot handle 'KSharedPixmap*' as argument of virtual
method KRootPixmap::updateBackground
from /usr/local/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:128:in
`method_missing'
from /usr/local/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:128:in
`qt_invoke' from
/usr/local/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:128:in
`method_missing'
from /usr/local/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:128:in `exec'

If I remove the class << pixmap ... end section the program runs ok (but
does not do what I want, of course). Any idea of what the error means in
this context? What am I doing wrong?
That means that 'KSharedPixmap*' is an unknown argument type, and can't be
marshalled from a C++ instance to a ruby value.

The problem is that the KSharedPixmap code in ksharedpixmap.h is bracketed
with:

#ifdef Q_WS_X11
....

#endif

And at the moment platform specific code is ignored when generating the
bindings, so that class isn't added to the Smoke library's runtime, and
can't be used from Korundum.

As it happens I was just looking at another '#ifdef' related problem for
Q_OS_UNIX - that code was being skipped too. I'll try and fix this for the
next release of Korundum (ie for KDE 3.4).

-- Richard
 
M

Mark Firestone

Ok. Here's the plan.

I have this here BBS. It knows how to speak fidonet and qwk/rep net,
but I would also like the users on it to be able to send and receive
smtp mail, and I would like to be able to use it as a listserv... so
that you could have a message area that exported new messages to folks
email accounts and imported incoming emails to the message area.

So, say general messages would be (e-mail address removed) and such.

I've been thinking I could use the Sendmail built into slackware. I
think I can configure it to accept any incoming email and put it in
/usr/spool/mail ? I don't really know much about it...

Take Care,

Mark

-----Original Message-----
From: Aredridel [mailto:[email protected]]
Sent: 05 February 2005 20:31
To: ruby-talk ML
Subject: Re: Email API

I want to build an internet email server into my Ruby BBS project. Does
anyone know of a good API to use?

POP, IMAP, SMTP or otherwise?

To do what?
 
M

Mark Firestone

What I'd really like to do is use sendmail on this slackware box, and
just talk to it. I looked at smtpd, and it's something I could work
on... but it seems like more work that needs to be done?

I also would want to integrate it into the BBS program, and I don't
think I can use ports < 1024 on linux without some sort of special magic
(or running as root)... Hmmm.

Take Care,

Mark

-----Original Message-----
From: Matt Armstrong [mailto:[email protected]]
Sent: 05 February 2005 20:25
To: ruby-talk ML
Subject: Re: Email API

Mark Firestone said:
I want to build an internet email server into my Ruby BBS project.
Does anyone know of a good API to use?

Are you talking about an SMTP server? Try looking at the code for
http://raa.ruby-lang.org/project/smtpd/ (but it looks unfinished)
 
M

Matt Armstrong

Mark Firestone said:
Ok. Here's the plan.

I have this here BBS. It knows how to speak fidonet and qwk/rep
net, but I would also like the users on it to be able to send and
receive smtp mail, and I would like to be able to use it as a
listserv... so that you could have a message area that exported new
messages to folks email accounts and imported incoming emails to the
message area.

So, say general messages would be (e-mail address removed) and such.

I've been thinking I could use the Sendmail built into slackware. I
think I can configure it to accept any incoming email and put it in
/usr/spool/mail ? I don't really know much about it...

Take Care,

Mark

For sending email, Ruby has that built in. Check out Net::SMTP. Your
Slackware box will have sendmail listening, and Net::SMTP can send to
it. The advantage of this approach is that someday your SMTP server
may change machines, and your BBS can just point to the new host.

For receiving email, you have a lot of options. I don't know all that
much about Sendmail, and how you can configure it (I am more familiar
with Postfix). I assume you will have some set of valid recipients,
and you'll want to some how inject the received messages into your BBS
for specific users?

If you end up having sendmail run a ruby script (via .forward or
otherwise) you might consider my program http://www.lickey.com/meg/ --
it will prevent "random" errors from causing mail bounces.

I have also written a local mail delivery agent (like procmail) -- see
http://www.lickey.com/rubyfilter/
 
A

Aredridel

So, say general messages would be (e-mail address removed) and such.

I've been thinking I could use the Sendmail built into slackware. I
think I can configure it to accept any incoming email and put it in
/usr/spool/mail ? I don't really know much about it...

One could have sendmail inject messages into the BBS, with an alias to a
pipe:

general: "|/usr/local/bbs/bin/deliver-bbs-message"
 
R

Richard Dale

<posted & mailed>

Richard said:
Martin said:
Hi,

I'm experimenting a bit with Korundum, but I'm having some problems. I
have the following code:

require 'Korundum'

app = Qt::Application.new([])
widget = Qt::Widget.new
pixmap = KDE::RootPixmap.new(widget)

class << pixmap
def updateBackground(x)
puts "update background"
end
end

pixmap.start

widget.show
app.setMainWidget(widget)
app.exec

When I run it I get this error:

ArgumentError: Cannot handle 'KSharedPixmap*' as argument of virtual
method KRootPixmap::updateBackground
from /usr/local/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:128:in
`method_missing'
from /usr/local/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:128:in
`qt_invoke' from
/usr/local/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:128:in
`method_missing'
from /usr/local/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:128:in `exec'

If I remove the class << pixmap ... end section the program runs ok (but
does not do what I want, of course). Any idea of what the error means in
this context? What am I doing wrong?
That means that 'KSharedPixmap*' is an unknown argument type, and can't be
marshalled from a C++ instance to a ruby value.

The problem is that the KSharedPixmap code in ksharedpixmap.h is bracketed
with:

#ifdef Q_WS_X11
...

#endif

And at the moment platform specific code is ignored when generating the
bindings, so that class isn't added to the Smoke library's runtime, and
can't be used from Korundum.

As it happens I was just looking at another '#ifdef' related problem for
Q_OS_UNIX - that code was being skipped too. I'll try and fix this for the
next release of Korundum (ie for KDE 3.4).
I've tried getting the KSharedPixmap class wrapped, but it uses multiple
inheritance with a diamond shaped hierachy and I had trouble getting the
C++ code for the binding to compile. So it might not be possible to include
it I'm afraid.

-- Richard
 
M

Mark Firestone

Thanks guys!

I decided to go with Ruby Mail to read messages in a mailbox that I
configured sendmail to put all messages sent to @bbs.retrobbs.org in.

This seems to work just fine... the only problem I am having is sending
messages. Sendmail is attaching the full username of the account that
runs the BBS software.. so I am getting ...

Mark Firestone (e-mail address removed)

Is there anyway to override this with NET::SMTP. I couldn't see one in
the docs...

Thanks!

Mark

-----Original Message-----
From: Aredridel [mailto:[email protected]]
Sent: 07 February 2005 07:41
To: ruby-talk ML
Subject: Re: Email API

So, say general messages would be (e-mail address removed) and such.

I've been thinking I could use the Sendmail built into slackware. I
think I can configure it to accept any incoming email and put it in
/usr/spool/mail ? I don't really know much about it...

One could have sendmail inject messages into the BBS, with an alias to a
pipe:

general: "|/usr/local/bbs/bin/deliver-bbs-message"
 
M

Matt Armstrong

Mark Firestone said:
Thanks guys!

I decided to go with Ruby Mail to read messages in a mailbox that I
configured sendmail to put all messages sent to @bbs.retrobbs.org in.

This seems to work just fine... the only problem I am having is
sending messages. Sendmail is attaching the full username of the
account that runs the BBS software.. so I am getting ...

Mark Firestone (e-mail address removed)

Is there anyway to override this with NET::SMTP. I couldn't see one in
the docs...

Do you fully qualify the From: header in the message you send? If you
send out

From: Mark Firestone <correct>

Sendmail may be set up to append a domain name.

Be aware that there are two "from" addresses when sending email.
There is the envelope sender (the second argument to
Net::SMTP#send_message) and the message from (what is in the From:
header). Which one is getting messed up?

If using /usr/sbin/sendmail (or equivalent), the command line argument
for setting the envelope sender is -f <envelope-sender>.
 
M

Mark Firestone

Just looking for some advice, about that boring ruby BBS that I'm always
rambling on about...

...I got the fido, and the smtp working... so I'm looking for a new
challenge, and it would be nice to actually have someone use the bloody
thing, so I thought, I'll hook it up to html...

What's the best way to code this? If I had designed this thing properly
from the get-go, I could just write a separate cgi script in e-ruby ...
as *most* of the data is stored in a postgres database.

The only stuff that isn't in postgres, is the user data, because it
would mean major surgery to change this (because of my poor design...
there are loads of places in the code where the program directly looks
at data.

Anyway, I thought of just building a ruby web server into the program,
in fact I've started playing with this... so should I do this, or go
though a major re-write to put the user stuff in postgres? As far as
http sessions go, can I assume that I'll keep the same TCP session for
an entire "user" session, or do I need cookies? And if so, how can my
web server keep track of this?

Seems like this will be one of those educational projects... again...
 
R

Robert Klemme

Mark Firestone said:
Just looking for some advice, about that boring ruby BBS that I'm always
rambling on about...

..I got the fido, and the smtp working... so I'm looking for a new
challenge, and it would be nice to actually have someone use the bloody
thing, so I thought, I'll hook it up to html...

What's the best way to code this? If I had designed this thing properly
from the get-go, I could just write a separate cgi script in e-ruby ...
as *most* of the data is stored in a postgres database.

The only stuff that isn't in postgres, is the user data, because it
would mean major surgery to change this (because of my poor design...
there are loads of places in the code where the program directly looks
at data.

Anyway, I thought of just building a ruby web server into the program,

=> Webrick
in fact I've started playing with this... so should I do this, or go
though a major re-write to put the user stuff in postgres?

I'd probably do that because it's more consistent.
As far as
http sessions go, can I assume that I'll keep the same TCP session for
an entire "user" session, or do I need cookies?

No, you cannot assume that since HTTP is stateless. Although HTTP 1.1
provides a means for reusing a connection you still have to deal with
interruptions etc.
And if so, how can my
web server keep track of this?

One standard approach is to use session cookies. And since it's so common
there's most likely a solution for this available already. You won't have
to code this yourself.
Seems like this will be one of those educational projects... again...

:)

Kind regards

robert
 
C

craig duncan

Mark said:
Just looking for some advice, about that boring ruby BBS that I'm always
rambling on about...

You *asked* for it (advice).
...I got the fido, and the smtp working... so I'm looking for a new
challenge, and it would be nice to actually have someone use the bloody
thing, so I thought, I'll hook it up to html...

What's the best way to code this? If I had designed this thing properly
from the get-go, I could just write a separate cgi script in e-ruby ...
as *most* of the data is stored in a postgres database.

The only stuff that isn't in postgres, is the user data, because it
would mean major surgery to change this (because of my poor design...
there are loads of places in the code where the program directly looks
at data.

Anyway, I thought of just building a ruby web server into the program,
in fact I've started playing with this... so should I do this, or go
though a major re-write to put the user stuff in postgres?

Yes... that's my advice. The best way of handling poor design (unavoidable, to some
extent, when you're not clear on your requirements -- or the problem -- at the start)
is to REdesign. Go for it. Unless you've got a deadline... why not do it right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top