Search in sources :

Example 6 with IMember

use of org.eclipse.ecf.bulletinboard.IMember in project ecf by eclipse.

the class Thread method getNewMessages.

public List<IThreadMessage> getNewMessages() throws BBException {
    ThreadBrowser2 browser = new ThreadBrowser2((AbstractBulletinBoard) bb, this);
    List<IThreadMessage> msgs = browser.fetchNewMessages();
    if (msgs.size() > 0) {
        lastReadMessageId = (ThreadMessageID) msgs.get(msgs.size() - 1).getID();
        for (IThreadMessage message : msgs) {
            ThreadMessage msg = (ThreadMessage) message;
            msg.setBulletinBoard(bb);
            msg.thread = this;
            IMember author = msg.author;
            ((Member) author).setBulletinBoard(bb);
        }
    }
    return msgs;
}
Also used : IThreadMessage(org.eclipse.ecf.bulletinboard.IThreadMessage) IThreadMessage(org.eclipse.ecf.bulletinboard.IThreadMessage) IMember(org.eclipse.ecf.bulletinboard.IMember) IMember(org.eclipse.ecf.bulletinboard.IMember)

Example 7 with IMember

use of org.eclipse.ecf.bulletinboard.IMember in project ecf by eclipse.

the class VBParser method parseMessage2.

private ThreadMessage parseMessage2(final ID id, final CharSequence seq) {
    ThreadMessage msg = null;
    ThreadMessageFactory tmf = new ThreadMessageFactory();
    msg = (ThreadMessage) tmf.createBBObject(id, null, null);
    Matcher m;
    String uname;
    Long l = parseTimestamp(seq);
    if (l != null) {
        msg.timePosted = new Date(l);
    }
    m = Pattern.compile("<div id=\"postmenu_" + ((ThreadMessageID) id).getLongValue() + "\">(.*?)</div>", Pattern.DOTALL).matcher(seq);
    if (m.find()) {
        String userInfoStr = m.group(1);
        m = PAT_MSG_USER.matcher(userInfoStr);
        if (m.find()) {
            MemberFactory mf = new MemberFactory();
            uname = new String(StringUtil.simpleStripHTML(m.group(3)));
            ID uid = null;
            try {
                uid = mf.createBBObjectId(namespace, baseURL, m.group(2));
            } catch (NumberFormatException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IDCreateException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            msg.author = (IMember) mf.createBBObject(uid, uname, null);
        } else {
            // Didn't find a registered author, so the userinfo should
            // contain only the username.
            msg.author = new Member(new String(userInfoStr.trim()));
        }
    }
    m = Pattern.compile("#<a href=\"showpost.php\\?p=" + ((ThreadMessageID) id).getLongValue() + "(?:.*?)><strong>([0-9]+)</strong></a>").matcher(seq);
    m.find();
    msg.number = Integer.parseInt(m.group(1));
    m = PAT_MSG_TITLE.matcher(seq);
    m.find();
    msg.setNameInternal(new String(StringUtil.stripHTMLTrim(m.group(1))));
    m = PAT_MSG_MESSAGE.matcher(seq);
    m.find();
    String message = StringUtil.stripHTMLFullTrim(m.group(1));
    msg.message = message;
    return msg;
}
Also used : ThreadMessageFactory(org.eclipse.ecf.internal.provider.vbulletin.internal.ThreadMessageFactory) Matcher(java.util.regex.Matcher) IDCreateException(org.eclipse.ecf.core.identity.IDCreateException) MemberFactory(org.eclipse.ecf.internal.provider.vbulletin.internal.MemberFactory) ThreadMessageID(org.eclipse.ecf.internal.provider.vbulletin.identity.ThreadMessageID) ID(org.eclipse.ecf.core.identity.ID) IMember(org.eclipse.ecf.bulletinboard.IMember) Date(java.util.Date)

Example 8 with IMember

use of org.eclipse.ecf.bulletinboard.IMember in project ecf by eclipse.

the class Thread method getNewMessages.

public List<IThreadMessage> getNewMessages() throws BBException {
    ThreadBrowser2 browser = new ThreadBrowser2((VBulletin) bb, this);
    List<IThreadMessage> msgs = browser.fetchNewMessages();
    if (msgs.size() > 0) {
        lastReadMessageId = (ThreadMessageID) msgs.get(msgs.size() - 1).getID();
        for (IThreadMessage message : msgs) {
            ThreadMessage msg = (ThreadMessage) message;
            msg.setBulletinBoard(bb);
            msg.thread = this;
            IMember author = msg.author;
            ((Member) author).setBulletinBoard(bb);
        }
    }
    return msgs;
}
Also used : IThreadMessage(org.eclipse.ecf.bulletinboard.IThreadMessage) IThreadMessage(org.eclipse.ecf.bulletinboard.IThreadMessage) IMember(org.eclipse.ecf.bulletinboard.IMember) IMember(org.eclipse.ecf.bulletinboard.IMember)

Aggregations

IMember (org.eclipse.ecf.bulletinboard.IMember)8 IOException (java.io.IOException)4 IThreadMessage (org.eclipse.ecf.bulletinboard.IThreadMessage)3 ID (org.eclipse.ecf.core.identity.ID)3 NameValuePair (org.apache.commons.httpclient.NameValuePair)2 GetRequest (org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest)2 WebRequest (org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest)2 MalformedURLException (java.net.MalformedURLException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 Matcher (java.util.regex.Matcher)1 BBException (org.eclipse.ecf.bulletinboard.BBException)1 IBBObject (org.eclipse.ecf.bulletinboard.IBBObject)1 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)1 AbstractBBObject (org.eclipse.ecf.internal.bulletinboard.commons.AbstractBBObject)1 MemberGroupID (org.eclipse.ecf.internal.provider.phpbb.identity.MemberGroupID)1 ThreadMessageID (org.eclipse.ecf.internal.provider.vbulletin.identity.ThreadMessageID)1 MemberFactory (org.eclipse.ecf.internal.provider.vbulletin.internal.MemberFactory)1