Subscription requests

Submitted by Anonymous on Tue, 2006-10-31 14:08.

Hi,

first of all, thanks for the great job.
I want to automatically accept subscription requests. For this purpose all subscription requests, regardless of which server the user account resides on, need to be intercepted and accepted. I know it can make Tigase vulnerable to spIM*.
I don't know how to start implementing this feature, can you help me please ?

Bruno

Trackback URL for this post:

http://www.tigase.org/en/trackback/108
kobit's picture
Submitted by kobit on Mon, 2006-11-06 13:29.

Yes, you are very close. process() method is the one to modify. You have to look at in_subscribe and out_subscribe events to modify subscription on your end.

To set subscription to whatever value you need just use helper class: tigase.xmpp.impl.Roster and method:
updateBuddySubscription.

Let me know if you have any problems...


Submitted by Anonymous on Mon, 2006-11-06 10:08.

1. yes
2. user B is connected to an unknown xmpp server. so I don't manage the roster of UserA. But if I reply a "suscribed" message, the unknown server will add UserB to the roster of UserA.

I have take a look at Presence class. I think I need to modify process() method; in case "in_subscribe" just call sendPresence(StanzaType.subscribed, packet.getElemFrom(), session.getJID(), results, null); and add userA to the roster of UserB with subscription 'both' (I don't know how to do that for now). Am I in the right way ?

Thanks very much for all your replies.

kobit's picture
Submitted by kobit on Fri, 2006-11-03 16:51.

Ok, let's go one step further with details.

All these subscriptions and presence stuff is quite complex so to make things simple do I correctly understand that is UserA want to subscribe to UserB it actually means that server should:

  1. add UserA to the roster of UserB with subscription 'both'
  2. and add UserB to the roster of UserA with subscription 'both'?

If this is a case and you want it to work for all users than indeed you should rewrite Presence class (which would be much simpler in your case) and load it instead of standard Presence class provided in Tigase server.


Submitted by Anonymous on Fri, 2006-11-03 15:32.

Hi,

what I want is when a jabber user (user A) subscribes to one of my tigase user (user B), my tigase server auto reply "subscribed" to user A. I don't want to bother user B with subscription stuff. Moreover I want this feature on server side in order to be client independent.
Am I clear ?
Thanks for your attention and advices.

kobit's picture
Submitted by kobit on Fri, 2006-11-03 14:05.

Hi again,

I was hoping that you give us more info about your problem. Presence class is one of the most complex classes as presence design is quite complex in XMPP. So I would rather avoid modifying it.

The better option would be probably to implement another processor which could catch selected presence stanzas and do what you want.

My worry is however, that it still might not be the most efficient solution for your case. If you could tell us what exactly you need and why you need it we could give you better advice/solution or we could even help you implement extension for your needs.


Submitted by Anonymous on Fri, 2006-11-03 11:29.

First thanks for your fast answer.
Yes, I want to implement it on server level. I will have a look at tigase.xmpp.impl.Presence class and I hope to success. I keep you inform.

kobit's picture
Submitted by kobit on Tue, 2006-10-31 14:51.

Hm, not sure if I understand you correctly.

You want to implement it on server level right? Why? I just found similar feature in the last Psi version. So Psi can automatically accept and authorize all subscription requests. Isn't it enough?

I am asking because I just need to understand your requirements correctly. There are quite a few possible ways to implement it in Tigase but selecting proper way depends on you use case.

The most strightforward way would be to reimplement tigase.xmpp.impl.Presence class to change behaviour on subscription request. The downside of such solution is that then you change behavior for ALL subscription requests. The more flexible approach would be to create another Presence which could coexists with existing one and for selected subscription requests it could execute desired action.

I was about to write a developers guide how to create new extensions for Tigase server. Well, it could be a good starting point...


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.