Clear chat

98 views
Skip to first unread message

John McLear

unread,
Jan 10, 2010, 10:03:42 AM1/10/10
to EtherPad Open Source Discussion
Does anyone have any code available to clear chat on a pad?

Marcel Waldvogel

unread,
Jan 11, 2010, 6:01:53 PM1/11/10
to EtherPad Open Source Discussion
In the database, you probably need to do the following:

DELETE FROM t USING PAD_CHAT_TEXT AS t INNER JOIN PAD_CHAT_META AS m
ON t.NUMID = m.NUMID WHERE m.ID == "12345678"
(where 12345678 is the ID of the pad). Then, in the JSON string in
PAD_META where PAD_META.ID = "12345678" set "numChatMessages" to 0

I don't know what you need to trigger a UI refresh, but at least, it
is a start…

John McLear

unread,
Feb 4, 2010, 11:35:09 AM2/4/10
to EtherPad Open Source Discussion
Quick update:

DELETE FROM t USING PAD_CHAT_TEXT AS t INNER JOIN PAD_CHAT_META AS m

ON t.NUMID = m.NUMID WHERE m.ID == "5"

UPDATE PAD_META where PAD_META.ID = "5" set "numChatMessages" = 0

Did that but when I restart etherpad I get

Oops! A server error occured. It's been logged.
Please email <sup...@etherpad.com> if this persists.

for that pad..

If I go in manually and just do:

UPDATE `etherpad`.`PAD_CHAT_TEXT` SET `DATA` = '{"time":
1265300759870,"userId":"g.yv30ms68posnjjt8","lineText":"sdfsdfsvfxcvxcvxcv"}
{"time":
1265300762785,"userId":"g.yv30ms68posnjjt8","lineText":"wheeee1"}'
WHERE `PAD_CHAT_TEXT`.`NUMID` =7 AND `PAD_CHAT_TEXT`.`PAGESTART` =0
AND `PAD_CHAT_TEXT`.`OFFSETS` = '84,72,,,,,,,,,,,,,,,,,,' AND
`PAD_CHAT_TEXT`.`DATA` = '{"time":
1265300759870,"userId":"g.yv30ms68posnjjt8","lineText":"sdfsdfsvfxcvxcvxcv"}
{"time":
1265300762785,"userId":"g.yv30ms68posnjjt8","lineText":"wheeee"}'
LIMIT 1 ;

Restart the server & it breaks the pad..

Then

UPDATE `etherpad`.`PAD_CHAT_TEXT` SET `DATA` = '{"time":
1265300759870,"userId":"g.yv30ms68posnjjt8","lineText":"sdfsdfsvfxcvxcvxcv"}
{"time":
1265300762785,"userId":"g.yv30ms68posnjjt8","lineText":"wheeee"}'
WHERE `PAD_CHAT_TEXT`.`NUMID` =7 AND `PAD_CHAT_TEXT`.`PAGESTART` =0
AND `PAD_CHAT_TEXT`.`OFFSETS` = '84,72,,,,,,,,,,,,,,,,,,' AND
`PAD_CHAT_TEXT`.`DATA` = '{"time":
1265300759870,"userId":"g.yv30ms68posnjjt8","lineText":"sdfsdfsvfxcvxcvxcv"}
{"time":
1265300762785,"userId":"g.yv30ms68posnjjt8","lineText":"wheeee1"}'
LIMIT 1 ;

Fixes the pad.

Then I tried changing "numChatMessages":2}}
To "numChatMessages":0}}

Restarted server with the change made and the pad chat was clear, new
entries go in starting at 1.

So to summarize, best method for clearing pad chat is just to change
the JSON string from numChatMessages:XX to numChatMessages:0

I will write a plugin and publish the changes on my blog, thanks for
the help Marcel

On Jan 11, 11:01 pm, Marcel Waldvogel

John McLear

unread,
Feb 4, 2010, 11:45:03 AM2/4/10
to EtherPad Open Source Discussion
Can anyone shed some light on how to tell the browser that the
numChatMessages is now 0?

On Feb 4, 4:35 pm, John McLear <johnym...@gmail.com> wrote:
> Quick update:
>
> DELETE FROM t USING PAD_CHAT_TEXT AS t INNER JOIN PAD_CHAT_META AS m
> ON t.NUMID = m.NUMID WHERE m.ID == "5"
>
> UPDATE PAD_META where PAD_META.ID = "5" set "numChatMessages" = 0
>
> Did that but when I restart etherpad I get
>
> Oops! A server error occured. It's been logged.

> Please email <supp...@etherpad.com> if this persists.

> Restarted server with the change made and the padchatwasclear, new


> entries go in starting at 1.
>

> So to summarize, best method for clearing padchatis just to change

Raja

unread,
Feb 5, 2010, 10:49:12 PM2/5/10
to EtherPad Open Source Discussion
John
From what I did earlier, the server pushes the chat messages to all
the clients, so if you are going to make numChatMessages = 0, then it
has to be told through the comet channel to all clients (like a chat
message) to clear all their chats.

On a individual node, this is maintained as an array of chat messages
which then gets printed onto the screen. I started going down the path
of creating a new command for clearing chat messages from any single
client, which then sends the message to all clients to clear all their
chats. Other things have come in the way and Im still working on it.
Ill try to see if I can finish up this weekend.

-- Raja

John McLear

unread,
Feb 6, 2010, 9:32:00 AM2/6/10
to etherpad-open-...@googlegroups.com
Thanks Raja, I appreciate your efforts

John McLear

unread,
Feb 10, 2010, 10:24:36 AM2/10/10
to EtherPad Open Source Discussion
Any luck over the wkend Raja? I have made an interface (the JSP and
CSS) if you want my code for that as to simply integrate it?

Raja

unread,
Feb 10, 2010, 10:46:49 PM2/10/10
to EtherPad Open Source Discussion
Sorry John, haven't made much progress. I will provide a diff as soon
as I get to my home machine. Its not complete and the server bits for
pushing it to other clients is the one missing. Local chat clears were
done already (I thought I attached a patch to this group earlier but
havent).

John McLear

unread,
Feb 21, 2010, 10:26:03 PM2/21/10
to EtherPad Open Source Discussion
Any move yet Raja?
Reply all
Reply to author
Forward
0 new messages