(int newStatus, String message)
| 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) { /* |
no test coverage detected