code: protected void sendMessage(CmsUUID toUserId, String message, boolean hasErrors) {
  
          CmsDbContext dbc = m_dbContextFactory.getDbContext();
          try {
              CmsUser toUser = m_driverManager.readUser(dbc, toUserId);
              CmsUserSettings settings = new CmsUserSettings(toUser);
              if (settings.getShowPublishNotification() || hasErrors) {
                  // only show message if publish notification is enabled or the message shows an error
                  OpenCms.getSessionManager().sendBroadcast(null, message, toUser);
              }
          } catch (CmsException e) {
              dbc.rollback();
              LOG.error(e.getLocalizedMessage(), e);
          } finally {
              dbc.clear();
          }
      }
docs: Sends a message to the given user, if publish notification is enabled or an error is shown in the message.<p>
  
  @param toUserId the id of the user to send the message to
  @param message the message to send
  @param hasErrors flag to determine if the message to send shows an error