forked from tsupo/Chirrup
-
Notifications
You must be signed in to change notification settings - Fork 1
/
haruFm.h
206 lines (171 loc) · 5.51 KB
/
haruFm.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/*
* haruFm.h : Haru.fm クライアント chirrup
* Haru.fm API を利用するための各種処理群 ヘッダファイル
* written by H.Tsujimura 27 Jun 2007
*
* Copyright (c) 2007 by H.Tsujimura (tsupo@na.rim.or.jp)
* All Rights Reserved.
*
* $Log: /comm/chirrup/haruFm.h $
*
* 1 09/05/14 3:50 tsupo
* (1) ビルド環境のディレクトリ構造を整理
* (2) VSSサーバ拠点を変更
*
* 7 07/09/06 19:42 Tsujimura543
* ダミーのコピーコンストラクタ、代入演算子を private として導入。
* 知らないうちにメモリ確保(と解放し忘れ)が発生する可能性を排除。
*
* 6 07/07/05 22:30 Tsujimura543
* Haru.fm のコメントツリーの更新に対応
*
* 5 07/07/05 0:49 Tsujimura543
* (1) GetStatFromJSON(), GetUserTimeline() の引数を変更
* (2) TWITTER_USER 構造体の変更(orig_userNameを追加)に伴う修正
*
* 4 07/07/04 18:01 Tsujimura543
* MakeMessageForScreen() と MakeMessageForLogging() を用意
*
* 3 07/07/03 17:45 Tsujimura543
* タグの表示に対応
*
* 2 07/07/03 14:53 Tsujimura543
* haru.fm 対応 (動作確認済み)
*
* 1 07/06/27 18:13 Tsujimura543
* 新規作成 (暫定版)
*/
#ifndef __HARU_FM_H__
#define __HARU_FM_H__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "CService.h"
// コメント
typedef struct haruFmComment {
CTime createdAt;
char id[MAX_KEYLENGTH * 2 + 2];
char text[MAX_DESCRIPTION_LEN];
// user
char userID[MAX_KEYLENGTH];
char userName[MAX_KEYLENGTH];
// for logging
char orig_text[MAX_DESCRIPTION_LEN * 2];
char orig_userName[MAX_KEYLENGTH * 2];
haruFmComment()
{
createdAt = CTime::GetCurrentTime();
id[0] = NUL;
text[0] = NUL;
userID[0] = NUL;
userName[0] = NUL;
orig_text[0] = NUL;
orig_userName[0] = NUL;
}
} HARUFM_COMMENT;
typedef struct haruFmCommentList {
long preCommentCount;
long commentCount;
HARUFM_COMMENT *comment;
haruFmCommentList()
{
preCommentCount = -1;
commentCount = 0;
comment = NULL;
}
} HARUFM_COMMENT_LIST;
// タグ
typedef struct haruFmTags {
char id[MAX_KEYLENGTH + 1];
char tag[MAX_KEYLENGTH + 1];
char orig_tag[MAX_KEYLENGTH * 2 + 2];
haruFmTags()
{
id[0] = NUL;
tag[0] = NUL;
orig_tag[0] = NUL;
}
} HARUFM_TAGS;
typedef struct haruFmTagList {
long numOfTags;
HARUFM_TAGS *tag;
haruFmTagList()
{
numOfTags = 0;
tag = NULL;
}
} HARUFM_TAG_LIST;
class CHaruFm : public CService
{
public:
CHaruFm();
~CHaruFm();
void DeleteReserved(TWITTER_STATUS *sp);
void DeleteReserved2(TWITTER_STATUS *sp);
// ユーザID
CString m_loginID;
// 発言を投稿
bool PostUpdate( CString monologue, ProceedingDialog *pdlg );
// friend_timeline を取得
CString GetFriendsTimeline( CTwitterTimeline *timeline,
ProceedingDialog *pdlg );
// public_timeline を取得
CString GetPublicTimeline( CTwitterTimeline *timeline,
ProceedingDialog *pdlg );
// user_timeline を取得
CString GetUserTimeline( CTwitterTimeline *timeline,
ProceedingDialog *pdlg );
// 自分のスクリーン名の取得
CString GetScreenName();
// 自分の ID の取得
CString GetLoginID();
bool OverwriteStatFromJSON(
const char *p,
const char *s,
TWITTER_STATUS *sp,
CString &message );
protected:
CString GetTimeline( CString &messages,
TWITTER_STATUS **stat,
long &numOfStats,
TIMELINE_TYPE t,
const char *endPointURL,
CTwitterTimeline *timeline,
ProceedingDialog *pdlg );
CString GetStatusID( const char *p,
const char *terminator );
void SetStatFromJSON(
const char *p,
const char *s,
TWITTER_STATUS *sp,
CString &message );
void MakeMessageForScreen(
CString &message,
TWITTER_STATUS *sp );
void MakeMessageForLogging(
TWITTER_STATUS *sp );
TWITTER_USER GetUserFromJSON( const char *p,
const char *terminator );
CTime GetCreatedAtFromJSON( const char *q, const char *terminator );
TWITTER_USER GetUserFromXML( const char *p, const char *terminator );
private:
char *GetContentFromJSON(
const char *q,
const char *terminator,
char *origString /* = NULL */
);
HARUFM_COMMENT_LIST *GetCommentsFromJSON(
const char *p,
const char *terminator,
long commentCount,
long preCommentCount
);
HARUFM_TAG_LIST *GetTagsFromJSON(
const char *p,
const char *terminator
);
private:
CHaruFm( CHaruFm &obj );
CHaruFm operator = ( CHaruFm &obj );
};
#endif /* __HARU_FM_H__ */