-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPasteOMaticPaster.h
49 lines (38 loc) · 1.23 KB
/
PasteOMaticPaster.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef PASTEOMATICPASTER_H
#define PASTEOMATICPASTER_H
/*
* Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Author:
* Andras Sevcsik <[email protected]>
*/
#include <Entry.h>
#include <Looper.h>
#include <Message.h>
#include <Messenger.h>
/*
* Website handlers should subclass this class.
* First, the application calls Check() with a mime string and its size.
* If it returns true, the application starts the message loop with Run(),
* then sends a PASTE_DATA message, which will call your according _Paste()
* function.
*/
class PasteOMaticPaster : public BLooper {
public:
PasteOMaticPaster(BHandler *handler);
virtual ~PasteOMaticPaster();
void MessageReceived(BMessage *message);
/* Return true, if you can handle mime type in "type" with "size" size */
virtual bool Check(char *type, size_t size);
bool success;
protected:
/* Upload paste, return link on success, or an error message.
* You have to free this in your destructor. Set success true on success.*/
virtual char *_Paste(void *data, size_t size);
virtual char *_Paste(entry_ref *ref);
void _Progress(int8 percentage);
void _Progress();
BHandler *fHandler;
};
#endif