SparkMeetPlugin: reduce logging

This commit is contained in:
Sergey Ponomarev 2025-07-26 10:59:08 +03:00
parent f212d884d0
commit fb3d5d763e
2 changed files with 21 additions and 35 deletions

View File

@ -66,7 +66,7 @@ public class ChatRoomDecorator
public void finished()
{
Log.warning("ChatRoomDecorator: finished " + room.getBareJid());
Log.debug("ChatRoomDecorator: finished " + room.getBareJid());
}
}

View File

@ -80,11 +80,11 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
if (props.getProperty("url") != null)
{
url = props.getProperty("url");
Log.warning("ofmeet-info: ofmeet url from properties-file is= " + url);
Log.debug("ofmeet-info: ofmeet url from properties-file is= " + url);
}
} catch (IOException ioe) {
Log.warning("ofmeet-Error:", ioe);
Log.error("ofmeet-Error:", ioe);
}
} else {
@ -136,8 +136,7 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
private String getServerUrl(String app) {
String serverUrl = null;
try {
try {
QueryRequest request = new QueryRequest(app);
request.setTo(JidCreate.fromOrThrowUnchecked(SparkManager.getSessionManager().getServerAddress()));
request.setType(IQ.Type.get);
@ -148,7 +147,7 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
if (response.url != null) serverUrl = response.url + "/";
} catch (Exception e) {
Log.warning("Unable to get meet url from server for app type " + app);
Log.error("Unable to get meet url from server for app type " + app);
}
return serverUrl;
}
@ -156,13 +155,12 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
public void commit(String url) {
this.url = url;
props.setProperty("url", url);
try {
try {
FileOutputStream outputStream = new FileOutputStream(pluginsettings);
props.store(outputStream, "Properties");
outputStream.close();
} catch (Exception e) {
Log.warning("ofmeet-Error:", e);
Log.error("ofmeet-Error:", e);
}
}
@ -170,7 +168,7 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
{
try
{
Log.warning("shutdown");
Log.debug("shutdown");
chatManager.removeChatRoomListener(this);
ProviderManager.removeIQProvider("query", QueryRequest.NAMESPACE);
@ -179,27 +177,21 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
}
catch(Exception e)
{
Log.warning("shutdown ", e);
Log.error("shutdown ", e);
}
}
@Override
public void messageReceived(ChatRoom room, Message message) {
try {
Localpart roomId = room.getJid().getLocalpart();
String body = message.getBody();
int pos = body.indexOf("https://");
if ( pos > -1 && (body.contains("/" + roomId + "-") || body.contains("meeting")) ) {
if (pos > -1 && (body.contains("/" + roomId + "-") || body.contains("meeting"))) {
showInvitationAlert(message.getBody().substring(pos), room, roomId);
}
} catch (Exception e) {
// i don't care
} catch (Exception ignored) {
}
}
private void showInvitationAlert(final String meetUrl, final ChatRoom room, final CharSequence roomId)
@ -313,8 +305,7 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
});
} catch (Exception t) {
Log.warning("Error opening url " + newUrl, t);
Log.error("Error opening url " + newUrl, t);
}
}
@ -326,8 +317,7 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
public void chatRoomClosed(ChatRoom chatroom)
{
String roomId = chatroom.getBareJid().toString();
Log.warning("chatRoomClosed: " + roomId);
Log.debug("chatRoomClosed: " + roomId);
if (decorators.containsKey(roomId))
{
@ -345,29 +335,25 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
public void chatRoomActivated(ChatRoom chatroom)
{
String roomId = chatroom.getBareJid().toString();
Log.warning("chatRoomActivated: " + roomId);
Log.debug("chatRoomActivated: " + roomId);
}
public void userHasJoined(ChatRoom room, String s)
{
String roomId = room.getBareJid().toString();
Log.warning("userHasJoined: " + roomId + " " + s);
Log.debug("userHasJoined: " + roomId + " " + s);
}
public void userHasLeft(ChatRoom room, String s)
{
String roomId = room.getBareJid().toString();
Log.warning("userHasLeft: " + roomId + " " + s);
Log.debug("userHasLeft: " + roomId + " " + s);
}
public void chatRoomOpened(final ChatRoom room)
{
String roomId = room.getBareJid().toString();
Log.warning("chatRoomOpened: " + roomId);
Log.debug("chatRoomOpened: " + roomId);
if (roomId.indexOf('/') == -1)
{
@ -377,7 +363,7 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
private void checkNatives()
{
Log.warning("checkNatives");
Log.debug("checkNatives");
new Thread()
{
@ -428,7 +414,7 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
{
String filePath = electronHomePath + File.separator + entry.getName();
Log.warning("writing file..." + filePath);
Log.debug("writing file..." + filePath);
if (!entry.isDirectory())
{
@ -450,7 +436,7 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
}
zipIn.close();
Log.warning("Native lib folder created and natives extracted");
Log.debug("Native lib folder created and natives extracted");
}
else {
Log.warning("Native lib folder already exist.");
@ -470,7 +456,7 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
}
catch (Exception e)
{
Log.warning(e.getMessage(), e);
Log.error(e.getMessage(), e);
}
}