Block Avatar

Hi

As number of users are around 1000, broadcasting avatar taking memory in each system. I need to block Avatar used in IM.

Any idea about this.

Regards

R Santhosh Kumar

Hi,

do you want to disable it on client side or on server side?

A server plugin similar to the Content Filter could help you a lot to avoid that avatars are saved - so you would also save some memory within your database.

LG

I need to block from server side.

Hi rsk,

We are adding support for avatar blocking (server side) in our Enterprise version of Wildfire. Of course, you are more than welcome to do the same using the Wildfire and Spark source code.

Cheers,

Derek

The folling is not a beatiful solution, but works if you having big trouble with your network.

I suggest try to make the changes creating a plugin. This kind you won´t loss the next WildFire updates.

In DefaultVCardProvider.java

include the folling lines in BOLD.

public Element loadVCard(String username) {

  • return null;*

synchronized (username.intern()) {

Element vCardElement = null;

java.sql.Connection con = null;

PreparedStatement pstmt = null;

SAXReader xmlReader = null;

try {

// Get a sax reader from the pool

xmlReader = xmlReaders.take();

con = DbConnectionManager.getConnection();

pstmt = con.prepareStatement(LOAD_PROPERTIES);

pstmt.setString(1, username);

ResultSet rs = pstmt.executeQuery();

while (rs.next()) {

vCardElement =

xmlReader.read(new StringReader(rs.getString(1))).getRootElement();

}

}

catch (Exception e) {

Log.error("Error loading vCard of username: " + username, e);

}

finally {

// Return the sax reader to the pool

if (xmlReader != null) {

xmlReaders.add(xmlReader);

}

try { if (pstmt != null) { pstmt.close(); } }

catch (Exception e) { Log.error(e); }

try { if (con != null) { con.close(); } }

catch (Exception e) { Log.error(e); }

}

return vCardElement;

}

}

public void createVCard(String username, Element vCardElement) throws AlreadyExistsException {

  • throw new AlreadyExistsException(“Username " + username + " already has a vCard”);*

if (loadVCard(username) != null) {

// The user already has a vCard

throw new AlreadyExistsException(“Username " + username + " already has a vCard”);

}

Connection con = null;

PreparedStatement pstmt = null;

try {

con = DbConnectionManager.getConnection();

pstmt = con.prepareStatement(INSERT_PROPERTY);

pstmt.setString(1, username);

pstmt.setString(2, vCardElement.asXML());

pstmt.executeUpdate();

}

catch (SQLException e) {

Log.error("Error creating vCard for username: " + username, e);

}

finally {

try { if (pstmt != null) { pstmt.close(); } }

catch (Exception e) { Log.error(e); }

try { if (con != null) { con.close(); } }

catch (Exception e) { Log.error(e); }

}

}

public void updateVCard(String username, Element vCardElement) throws NotFoundException {

  • return null;*

if (loadVCard(username) == null) {

// The user already has a vCard

throw new NotFoundException(“Username " + username + " does not have a vCard”);

}

Connection con = null;

PreparedStatement pstmt = null;

try {

con = DbConnectionManager.getConnection();

pstmt = con.prepareStatement(UPDATE_PROPERTIES);

pstmt.setString(1, vCardElement.asXML());

pstmt.setString(2, username);

pstmt.executeUpdate();

}

catch (SQLException e) {

Log.error("Error updating vCard of username: " + username, e);

}

finally {

try { if (pstmt != null) { pstmt.close(); } }

catch (Exception e) { Log.error(e); }

try { if (con != null) { con.close(); } }

catch (Exception e) { Log.error(e); }

}

}