Users added to MySQL DB (using PHP) show in users/groups but not in room

Using Wildfire 2.6.2

I’'m adding users via PHP to the following tables:

jiveUser (username,password,name,email,creationDate,modificationDate)

mucMember (roomID,jid)

Which seem to be the same tables hit by the internal Wildfire script.

The user shows up in users/groups (might be called slightly differently in English) within seconds but only show up as user in a chatroom after a shutdown/restart of wildfire.

I’'ve tried what happens if the following values were set to 100:

cache.username2roster.time

cache.userCache.expirationTime

But that didn’'t help.

Also went to cache summary and cleared all, but that didn’'t help either.

Right now I slowly start to run out of ideas. Any pointers would be greatly appreciated.

What I try to do is get users to login and go to the chatroom without doing anything more then click a single URL. I don’'t want to put them through having to join a chatroom.

FWIW, I’‘m aware of the contributed user import/export but that isn’‘t going to be any good for me. Users will be added and removed multiple times during the day. Quite a taks if you can’'t automate it.

any ideas?

I am having this problem too.

Hi All,

Generally speaking it is a bad idea to manipulate the Wildfire’‘s tables while it is running (do a search on these forums for more details). In your case(s) it sounds like the best approach for adding/editing/deleting users is to use the User Service plugin. Unfortunately, that plugin does not support remote management of a users’’ roster, but that sort of functionality could easily be added to the plugin.

Hope that helps,

Ryan

Hi mrbvo,

If I’‘m not mistaken, you are actually refering to the problem mentioned in your previous thread, aren’‘t you? IMHO, Justin’‘s source code perhaps didn’‘t work the way you wanted because, the way I see it, you will still have to restart your wildfire every time you make changes in the MUC tables. You have successfully been able to add users by modifying the UserService plugin, but you’'re still not able to join the room automatically and update the MUC tables on the fly, right?

Ryan was right about not to temper the database directly particularly with the MUC tables. Additionally, the API doesn’'t provide a simple approach of how to auto-join user in MUC rooms. It seems to me like the present code allows joining a room only through direct user interaction.

So, if you want to auto-join, you’‘ll have to simulate user interaction. That’‘s how I figured it out through MUC source code. I did mentioned in your last thread of how you could go about it but perhaps you didn’‘t try it. Here’'s an edited copy (simplified, no import & no error checking) of my last codes, in case you want to reconsider trying:

public void createUser(String username, String password, String name, String email, String roomName) throws UserAlreadyExistsException{
XMPPServer server = XMPPServer.getInstance();
UserManager userManager = server.getUserManager();
String localhost = server.getServerInfo().getName();
MultiUserChatServer multiUserChatServer = server.getMultiUserChatServer();
Presence presence;
MUCUser mucuser;
MUCRoom room;
MUCRole role; userManager.createUser(username, password, name, email); /* Simulate JEP-45 user enter room case */
presence = new Presence();
presence.setFrom(username + "@" + localhost + "/" + "some_resource");
presence.setTo(roomname + "@" + mucUserChatServer.getServiceDomain() + "/" + username);
presence.addChildElement("x", "http://jabber.org/protocol/muc"); /* This will create muc user if it''s not created yet. Don''t get confused with userManager.createUser above. This new muc user creation is an abstract user needed within a MultiUserChatServer instance */
mucUser = multiUserChatServer.getChatUser(presence.getFrom()); /* This will create the room if it''s not created yet. */
room = multiUserChatServer.getChatRoom(roomName, presence.getFrom()); /* joinRoom (String, String, HistoryRequest, MUCUser, Presence) */
role = room.joinRoom(username, null, null, mucUser, presence.createCopy());
room.unlock(role); /* Make sure it''s saved in the database if you want it to be persistant */
room.setPersistent(true);
room.saveToDB();
}

Message was edited by: aznidin