소스 검색

Send a Topic discovery if we get an end of names before we get a topic. Fixes issue 3095

tags/0.6.3
Shane Mc Cormack 14 년 전
부모
커밋
d000e2734c
3개의 변경된 파일38개의 추가작업 그리고 0개의 파일을 삭제
  1. 19
    0
      src/com/dmdirc/parser/irc/IRCChannelInfo.java
  2. 18
    0
      src/com/dmdirc/parser/irc/ProcessNames.java
  3. 1
    0
      src/com/dmdirc/parser/irc/ProcessTopic.java

+ 19
- 0
src/com/dmdirc/parser/irc/IRCChannelInfo.java 파일 보기

60
     private String sTopicUser = "";
60
     private String sTopicUser = "";
61
     /** Unixtimestamp representing time when the topic was set. */
61
     /** Unixtimestamp representing time when the topic was set. */
62
     private long nTopicTime = 0;
62
     private long nTopicTime = 0;
63
+    /** Has this channel ever had a topic? */
64
+    private boolean hadTopic = false;
63
     
65
     
64
     /** Known boolean-modes for channel. */
66
     /** Known boolean-modes for channel. */
65
     private long nModes;
67
     private long nModes;
191
             }
193
             }
192
         }
194
         }
193
     }
195
     }
196
+
194
     
197
     
198
+    /**
199
+     * Has this channel ever had a topic? (even an empty one!)
200
+     * 
201
+     * @return True if a topic has ever been known for this channel.
202
+     */
203
+    public synchronized boolean hadTopic() {
204
+        return hadTopic;
205
+    }
206
+
207
+    /**
208
+     * Change the value of hadTopic to true.
209
+     */
210
+    public synchronized void setHadTopic() {
211
+        this.hadTopic = true;
212
+    }
213
+
195
     /**
214
     /**
196
      * Have we ever asked the server for this channels listmodes?
215
      * Have we ever asked the server for this channels listmodes?
197
      *
216
      *

+ 18
- 0
src/com/dmdirc/parser/irc/ProcessNames.java 파일 보기

24
 
24
 
25
 import com.dmdirc.parser.interfaces.ChannelInfo;
25
 import com.dmdirc.parser.interfaces.ChannelInfo;
26
 import com.dmdirc.parser.interfaces.callbacks.ChannelNamesListener;
26
 import com.dmdirc.parser.interfaces.callbacks.ChannelNamesListener;
27
+import com.dmdirc.parser.interfaces.callbacks.ChannelTopicListener;
27
 
28
 
28
 /**
29
 /**
29
  * Process a Names reply.
30
  * Process a Names reply.
43
             iChannel = getChannel(token[3]);
44
             iChannel = getChannel(token[3]);
44
             if (iChannel == null) { return; }
45
             if (iChannel == null) { return; }
45
             
46
             
47
+            if (!iChannel.hadTopic()) {
48
+                callChannelTopic(iChannel, true);
49
+            }
50
+
46
             iChannel.setAddingNames(false);
51
             iChannel.setAddingNames(false);
47
             callChannelGotNames(iChannel);
52
             callChannelGotNames(iChannel);
48
             
53
             
102
         }
107
         }
103
     }
108
     }
104
     
109
     
110
+    /**
111
+     * Callback to all objects implementing the ChannelTopic Callback.
112
+     *
113
+     * @see IChannelTopic
114
+     * @param cChannel Channel that topic was set on
115
+     * @param bIsJoinTopic True when getting topic on join, false if set by user/server
116
+     * @return true if a method was called, false otherwise
117
+     */
118
+    protected boolean callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
119
+        ((IRCChannelInfo)cChannel).setHadTopic();
120
+        return getCallbackManager().getCallbackType(ChannelTopicListener.class).call(cChannel, bIsJoinTopic);
121
+    }
122
+
105
     /**
123
     /**
106
      * Callback to all objects implementing the ChannelGotNames Callback.
124
      * Callback to all objects implementing the ChannelGotNames Callback.
107
      *
125
      *

+ 1
- 0
src/com/dmdirc/parser/irc/ProcessTopic.java 파일 보기

78
      * @return true if a method was called, false otherwise
78
      * @return true if a method was called, false otherwise
79
      */
79
      */
80
     protected boolean callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
80
     protected boolean callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
81
+        ((IRCChannelInfo)cChannel).setHadTopic();
81
         return getCallbackManager().getCallbackType(ChannelTopicListener.class).call(cChannel, bIsJoinTopic);
82
         return getCallbackManager().getCallbackType(ChannelTopicListener.class).call(cChannel, bIsJoinTopic);
82
     }
83
     }
83
     
84
     

Loading…
취소
저장