Is that possible to make automatica buddies

Hi,

I am developing IM Bot based application in which all the users in a particular server should be buddy of BOT so that the presence of all the users would be know to BOT.By Using which i can track the online and offline status change of the users…

So i require to make a dynamic buddylist by programatically or by means of any database update…

Please help me out…

Thanks in Advance…

You have to add people to your roster to see their online status. This usually requires their approval, which makes it impossible to monitor everyone on a arbitrary server.

If the server is under your control, it might be better to create a plugin on the server side.

I understand that we require proper authorization in order to make mutual buddies…

But i need to broke the conventional setup and i have to make all the users are the buddies of the IMBOT(say Bot@servername)…

This is my core logic to track the status of the buddies or users in general by IMBOT…

I own the server control…

I have already tried in the following ways…

I am using external database…

I have INSERTED rows in the table JIVEROSTER and JIVEROSTERGROUPS to make buddy of the user IMBOT…

My problem is whenever new user is added then i could not able to make buddy of IMBOT dynamically…During such situations restart of the wildifire server after inserting in JIVEROSTER AND JIVEROSTERGROUPS is required…

Can you please guide me on this regard…

Message was edited by: sadasivamb@hcl.in

Message was edited by: sadasivamb@hcl.in

Writing directly to the database definitely isn’'t the most desirable solution. Since you control the server, and you already know Smack well enough to make a bot, I think you should create an Openfile plugin that monitors registrations and adds your bot as a buddy to new users. Then your bot can do whatever else it wants.

Openfire Plugin Development Guide

I solve a similar problem by putting the users in the same group. If you don’‘t want the users to see the bot, you could automatically add them to a group that’'s visible to the bot (exclusively? - put the bot in his own group, make the new one visible only to that).

The users will see that they are in a group though, I guess. All the other users will appear as part of a group to them.

Here’'s some of my plugins code:

/**

  • Adds user to given group.

*/

public void addUserToGroup(String userName, String groupName) {

if (userName == null || groupName == null || “”.equals(userName)

|| “”.equals(groupName)) return;

try {

Group group = groupManager.getGroup(groupName);

group.getMembers().add(XMPPServer.getInstance().createJID(userName, null));

}

catch (GroupNotFoundException e) {

Log.error(e);

}

}

/**

  • Removes user from given group. If no group name is given, removes user

  • from all groups.

*/

public void removeUserFromGroup(String userName, String groupName) {

if (userName == null || “”.equals(userName)) return;

try {

if (groupName != null) {

Group group = groupManager.getGroup(groupName);

group.getMembers().remove(XMPPServer.getInstance().createJID(

userName, null));

} else

for (Group group : groupManager.getGroups()) {

group.getMembers().remove(XMPPServer.getInstance().createJID(

userName, null));

}

}

catch (GroupNotFoundException e) {

Log.error(e);

}

}

/**

  • Creates a shared group.
  • @param groupName name of group to create, required

  • @param description description of group, may be empty

  • @param displayName name to display, required

  • @param showType type of sharing, may be empty, “nobody”, “everybody”, “onlyGroup”

  • @param groupNames comma separated list of groups in which this group is visible, may be empty

  • @return whether successful

*/

public boolean createSharedGroup(String groupName, String description,

String displayName, String showType, String groupNames) {

if (groupName == null || “”.equals(groupName)) {

Log.warn(“no group name, nothing to do”);

return false;

}

if (displayName == null || “”.equals(displayName)) {

Log.error(“display name required for shared group”);

return false;

}

try {

Group newGroup = groupManager.createGroup(groupName);

if (description != null) newGroup.setDescription(description);

if ((!"".equals(showType)) && (showType != null)) {

newGroup.getProperties().put(“sharedRoster.showInRoster”, showType);

}

else {

newGroup.getProperties().put(“sharedRoster.showInRoster”, “nobody”);

}

if (displayName != null) {

newGroup.getProperties().put(“sharedRoster.displayName”, displayName);

}

if (groupNames != null) {

newGroup.getProperties().put(“sharedRoster.groupList”, groupNames);

}

}

catch (GroupAlreadyExistsException e) {

Log.error(e);

return false;

}

return true;

}