MCPcopy Index your code
hub / github.com/BombusMod/BombusMod / sendPresence

Method sendPresence

src/main/java/Client/Roster.java:889–953  ·  view source on GitHub ↗
(int newStatus, String message)

Source from the content-addressed store, hash-verified

887//#endif
888
889 public void sendPresence(int newStatus, String message) {
890 if (newStatus != Presence.PRESENCE_SAME) {
891 myStatus = newStatus;
892 }
893
894 if (message != null) {
895 myMessage = message;
896 }
897
898 setQuerySign(false);
899
900 if (myStatus != Presence.PRESENCE_OFFLINE) {
901 lastOnlineStatus = myStatus;
902 }
903
904 // reconnect if disconnected
905 if (myStatus != Presence.PRESENCE_OFFLINE && !isLoggedIn()) {
906 synchronized (hContacts) {
907 doReconnect = (hContacts.size() > 1);
908 }
909 redraw();
910 new Thread(this).start();
911 return;
912 }
913
914 blockNotify(-111, 13000);
915
916 if (isLoggedIn()) {
917 if (myStatus == Presence.PRESENCE_OFFLINE && !cf.collapsedGroups) {
918 groups.queryGroupState(false);
919 }
920
921 // send presence
922 ExtendedStatus es = sl.getStatus(myStatus);
923 if (message == null) {
924 myMessage = StringUtils.toExtendedString(es.getMessage());
925 }
926
927 myMessage = StringUtils.toExtendedString(myMessage);
928 int myPriority = es.getPriority();
929
930 Presence presence = new Presence(myStatus, myPriority, myMessage, sd.account.nick);
931
932 if (!sd.account.mucOnly) {
933 sd.getTheStream().send(presence);
934 }
935//#ifndef WMUC
936 reEnumerator = null;
937 multicastConferencePresence(myStatus, myMessage, myPriority);
938//#endif
939 }
940
941 // disconnect
942 if (myStatus == Presence.PRESENCE_OFFLINE) {
943 try {
944 sd.getTheStream().close(); // sends </stream:stream> and closes socket
945 sd.getTheStream().loggedIn = false;
946 } catch (Exception e) { /*

Callers 15

sendDirectPresenceMethod · 0.95
doSubscribeMethod · 0.95
loginSuccessMethod · 0.95
loadAccountMethod · 0.95
doReconnectMethod · 0.95
logoffMethod · 0.95
leaveRoomMethod · 0.95
deleteContactMethod · 0.95
blockArrivedMethod · 0.80
blockArrivedMethod · 0.80
connectionTerminatedMethod · 0.80
blockArrivedMethod · 0.80

Calls 15

setQuerySignMethod · 0.95
isLoggedInMethod · 0.95
blockNotifyMethod · 0.95
toExtendedStringMethod · 0.95
getMessageMethod · 0.95
getPriorityMethod · 0.95
makeRosterOfflineMethod · 0.95
selfContactMethod · 0.95
setStatusMethod · 0.95
queryGroupStateMethod · 0.80
getTheStreamMethod · 0.80

Tested by

no test coverage detected